-
Notifications
You must be signed in to change notification settings - Fork 150
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
a way to retreive all public tables #753
Conversation
If we're to have the same functions as sqlalchemy, I'd prefer having same logic/behavior as sqlalchemy. https://github.com/sqlalchemy/sqlalchemy/blob/master/lib/sqlalchemy/dialects/mysql/base.py#L2939 and https://github.com/sqlalchemy/sqlalchemy/blob/master/lib/sqlalchemy/dialects/postgresql/base.py#L3286 are a bit different than the ones in the diff. |
My PR reflects acts as such as well. However, I am working on a way to have gino have full access to sqlalchemy functions without throwing the error of #751. This PR however reflects the bare minimum for getting back some metadata into the gino engine. Something that is otherwise completely unavailable |
To clarify, the function signature is not the same (missing
You can still execute raw SQL using gino as the same as what is done in this PR. |
Okay, I understand, I guess that means I'll have to ensure that they are all the same because I really do want those functions available. I'd rather not have the write specific SQL queries every time I want to get database metadata while working with gino |
I'd keep the function in a util package which accepts connection object to return the result. |
original that was the plan, but
|
I think it depends on the functions you refer to. Unlike SQLAlchemy a complete ORM, gino is trying to be lightweight and explicit. We will see a lot of sqlalchemy features not here, especially ORM-related ones. In your case, if it's common to multiple projects, it's also an option to have a common package every project and import and use. |
I am not trying to turn gino into a complete ORM. I just wanted a few metadata, like available public tables, table constraints, oids, and the likes. The problem is that these functions are already available in GINO via inheritance from SQLalchemy. But then when you try to use those functions an error occurs, which is definitely not the best. |
I agree gino has a long way to go to provide enough functions for general usage. |
A way to retrieve all the public tables in databases #751 by creating a get_tables function in both the Postgres and MySQL dialect. In the absence of the reflection and inspection abstraction of sqlalchemy in gino, this is the least possible way of retrieving some form of metadata from the database without having to write personalized SQL queries in your project. It works the same as any function in the dialect module of the gino connection or engine.