Skip to content

Reflect Via metadata failing #751

Open
@maestro-1

Description

@maestro-1

Describe the bug
In using gino I tried to use the reflect, but it fails. I speculate this is because it runs as a default sqlalchemy function rather than a gino spinoff, but since it is a gino engine it fails.
To Reproduce
Please provide a self-contained script to reproduce the bug if possible.

from gino import Gino

db = Gino()

#I tried 
loop.run_until_complete(db.reflect())

#also tried  
db.reflect()

result

AttributeError: 'GinoEngine' object has no attribute 'connect'

Now for good measure, I tried a few other alternatives

from gino import Gino
db = Gino
db.gino._item.reflect()

The result was the same.

I need to e able to retrieve metadata from the database without having prior knowledge of items in it. Things like all the available tables. All the columns in a specified table and so on. Gino does not seem to support these key features. I would have proceeded to do this with sqlalchemy, but seeing that I am already using gino(and gino engine) I cannot because sqlalchemy does not recognize gino engines hence features like reflect, inspect and engine.dialect.get_table_names are not available in gino.
Now there is the option of creating one sqlalchemy engine and one gino engine for the same database but then that seems counterintuitive.
All the fails stem from variation in function names like connect instead of acquire except for dialect.get_table_name which is completely unavailable

Environment (please complete the following information):

  • GINO: [e.g. 1.0.1]
  • SQLAlchemy: [e.g. 1.3.10]
  • Linux, PostgreSQL 10, asyncpg 0.21

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugDescribes a bug in the system.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions