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
Describe the bug
When trying to insert rows from stdin into a table on a mysql DB, if the table exists in 2 schemas, the insert fails with
sq: insert ctx.table failed: failed to create dest table ctxt.table: Error 1050 (42S01): Table 'table' already exists
To Reproduce
In my case the issue happens with a users table, I'm running a docker compose image of mysql and since there is a default schema performance_schema that contains a users table, I get the error
If your issue pertains to a particular source (e.g. a Postgres database),
paste the output of sq inspect --overview --yaml @your_source into the
code block below. You may redact any sensitive fields.
The issue seems to be located (at least on the mysql driver) on the following file/line code
I see 2 potential solutions, either query the INFORMATION_SCHEMA and filtering by schema or instead of doing a comparison for == 1 doing it like >= 1.
While the second solution would be super simple to implement the potential problem is if the table does not exists on the destination schema but if it exists on another schema, we'd bypass the creation of the table. The first approach seems more failproof.
The text was updated successfully, but these errors were encountered:
Describe the bug
When trying to insert rows from stdin into a table on a mysql DB, if the table exists in 2 schemas, the insert fails with
sq: insert ctx.table failed: failed to create dest table ctxt.table: Error 1050 (42S01): Table 'table' already exists
To Reproduce
In my case the issue happens with a users table, I'm running a docker compose image of mysql and since there is a default schema performance_schema that contains a users table, I get the error
Expected behavior
The insert should work since without trying to create the table since it already exists.
sq
versionPaste the output of
sq version --yaml
into the code block below:Source details
If your issue pertains to a particular source (e.g. a Postgres database),
paste the output of
sq inspect --overview --yaml @your_source
into thecode block below. You may redact any sensitive fields.
Logs
n/a
Screenshots
n/a
Additional context
The issue seems to be located (at least on the mysql driver) on the following file/line code
I see 2 potential solutions, either query the INFORMATION_SCHEMA and filtering by schema or instead of doing a comparison for == 1 doing it like >= 1.
While the second solution would be super simple to implement the potential problem is if the table does not exists on the destination schema but if it exists on another schema, we'd bypass the creation of the table. The first approach seems more failproof.
The text was updated successfully, but these errors were encountered: