-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ENH] Allow passing MetaData (or meta kwargs) to high-level SQL functions #7441
Comments
@aldanor on the For passing a So basically, we just have to decide if we want to provide this functionality in both ( |
@jorisvandenbossche It may be just me, but I think it might make sense to allow the metadata object to be passed to the higher-level functions (or a set of arbitrary kwargs for reflect since there may be dialect-specific options) for those functions to be useful in setups more involved than the most basic ones. In some environments (e.g. a typical corporate Oracle setup), you would absolutely have to pass the |
What would be the most common things you would want to adapt in the meta object? Of course the Just asking as if the |
@jorisvandenbossche Do we consider the As for myself, I sometimes have to use |
As I said above, the For the API, that seems a good option. Another one would be to provide a way to pass options directly to Would you be interested to do a PR to add this? |
I'm by no means sqlalchemy expert, so if someone more skilled in this would do it, it would be a better idea :) Elsewise I can give it a try on the weekend, will have to figure out how to set up test environment etc for the sql test suite then. Re: API, |
@jorisvandenbossche Would someone help me out in setting up a test environment so that I can run all tests in |
An overview:
So no special schema or something, I think for both default values when you would create such a database locally. If you want tro try to set-up something like #7091 or what you linked to, certainly try! If we support specifying schema's, will will also have to test this, so the database set-up will have to be more advanced. |
@aldanor Did it work out to look at this? |
@jorisvandenbossche status? |
I have unfortunately no time this week to do it myself, so pushing to 0.15 |
Example usages:
|
This is partly implemented (schema kwarg, possibility to pass meta to SQLDatabase), but pushing to 0.15.1 to see if we want to provide more. |
I'm resurrecting an ancient issue here, but is there any interest in including Anyways, it's an addition that I would find very useful, but I am new to contributing to Pandas, so someone feel free to please set me straight here. 🙏 |
Use case: I want to query an Oracle table but I'm not the owner, so
meta.reflect(engine)
would do nothing and always return an empty list of tables renderingread_sql_table
useless. This works:meta.reflect(engine, schema='the_real_owner')
, however there's no way of passing the metadata / schema to the high-level pandas.io.sql functions. One may also want to use ameta.reflect(engine, only=[...])
ormeta.reflect(engine, oracle_resolve_synonyms=True)
or any other dialect-specific argument.PandasSQLAlchemy
class already support passingmeta
in the constructor, so it's just a matter of a adding an extra keyword argument to the three io.sql.read_sql* functions. Or maybe allow passing through arbitrary kwargs to meta's reflect method, likeread_sql_table(table, engine, reflect=dict(schema='my_schema', oracle_resolve_synonyms=True))
-- ugly but functional.The text was updated successfully, but these errors were encountered: