Skip to content
This repository has been archived by the owner on May 5, 2022. It is now read-only.

support df.to_sql(catalog=name ...) #39

Open
erikerlandson opened this issue Nov 25, 2021 · 2 comments
Open

support df.to_sql(catalog=name ...) #39

erikerlandson opened this issue Nov 25, 2021 · 2 comments

Comments

@erikerlandson
Copy link

Currently the only way I know to tell sqlalchemy-trino about trino catalog name is in the connection url.
That works pretty well but it would be conceptually cleaner to support df.to_sql(catalog=name, schema=name ...)

@dungdm93
Copy link
Owner

Hello @erikerlandson It's pandas, right?
Currently, df.to_sql has no catalog param, so there is no way to pass catalog to trino driver.
If you find a way to do this, feel free to create a PR.

@erikerlandson
Copy link
Author

Studying code, the sanest approach I can think of that might work is to modify the biz-logic in the TrinoDialect methods to attempt a split of schema on . and split into catalog_name.schema_name, then add WHERE catalog = catalog_name clauses to various methods.

In such an approach, there would be no separate catalog =, but you would specify schema=catalog.schema.

The only other approach that came to mind was monkey-patching df.to_sql, but looking at how sqlalchemy is architected I suspect that adding a concept of "catalog" might have to be plumbed through a lot of layers of code, and would end up back in TrinoDialect anyway.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants