Closed laggingreflex closed 3 years ago
Presumably this is caused by: https://github.com/simonw/db-to-sqlite/blob/bd199449367e32650b399041eec837982f016da7/db_to_sqlite/cli.py#L88-L92
That select * from {table}
query needs to somehow grow awareness of database engine specific escaping conventions for table names.
Looks like I need to figure out how to call quote_identifier
in SQLAlchemy for the current engine's database dialect: https://docs.sqlalchemy.org/en/14/core/internals.html#sqlalchemy.sql.compiler.IdentifierPreparer.quote_identifier
Searched here: https://github.com/search?l=Python&q=engine+quote_identifier&type=Code
def quote_group_name(db: Union[Connection, Engine], group_name: str) -> str:
dialect = db.dialect
return dialect.preparer(dialect).quote_identifier(group_name)
quoter = connection.dialect.identifier_preparer.quote_identifier
If you have a table named "user" in PostgreSQL it isn't copied.
It does create the table, but the entries do not reflect the original table. The entries I see are just one row "1 postgres".
It seems the issue is that in Postgres
user
is a pseudo-function keyword