You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to import values using COPY FROM piped from a readable stream, but the sql helper only gives me errors.
The example from the docs works as written:
constuserStream=Readable.from(['Murray\t68\n','Walter\t80\n'])constquery=awaitsql`copy test_table ( name, age ) from stdin`.writable()awaitpipeline(userStream,query);
But, if I want to interpolate the table and/or column names, it doesn't work:
consttableName='test_table'constcols=['name','age']// Interpolate both table name and columnsconstquery=awaitsql`copy ${sql(tableName)} (${sql(cols)}) from stdin`.writable()// --> Error: Could not infer helper mode// Only interpolate columnsconstquery=awaitsql`copy test_table (${sql(cols)}) from stdin`.writable()// --> Error: Could not infer helper mode// Only interpolate table nameconstquery=awaitsql`copy ${sql(tableName)} (name, age) from stdin`.writable()// --> PostgresError: syntax error at end of input
I'm trying to import values using COPY FROM piped from a readable stream, but the sql helper only gives me errors.
The example from the docs works as written:
But, if I want to interpolate the table and/or column names, it doesn't work:
There's a full (non) working example here: https://gist.github.com/partap/fefc18a0d294dae033c893f2d2828187
The text was updated successfully, but these errors were encountered: