You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make a convenient way for GinoConnection to generate and execute DDLs #749
Is your feature request related to a problem? Please describe.
The only way to create tables described is with db.gino.create_all(...) or it's alias db.gino.create(...). But in case one needs to execute an auto-generated DDL while being in a transaction there's no simple way to do that.
That took me a load of time of debugging to gain a working way:
Here we call a "protected" method of GinoConnection class which violates coding guides since underscore methods are not intended to be called by class guests.
Describe the solution you'd like
For example, the AsyncSchemaGenerator (or it's subclass which is my case) could be bound to every GinoConnection yielded from a pool and then there be just a simple GinoConnection.create(self, tables, **kwargs) method that allows a user to execute DDL generated. The AsyncSchemaGenerator could of course be passed through from the very db down to GinoConnection constructor through whatever middlewares exist: Pools and so on.
Right, the "protected" shouldn't be used, as they will be gone in GINO 1.4 which will adopt SQLAlchemy 1.4 with its asynchronous support, we won't need the AsyncSchemaGenerator hack any more at that time. Please check the v2.0.x branch (and upcoming v1.4.x branch) for updates.
Activity
fantix commentedon Mar 21, 2021
Right, the "protected" shouldn't be used, as they will be gone in GINO 1.4 which will adopt SQLAlchemy 1.4 with its asynchronous support, we won't need the
AsyncSchemaGeneratorhack any more at that time. Please check the v2.0.x branch (and upcoming v1.4.x branch) for updates.