Open SantjagoCorkez opened 3 years ago
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.
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 aliasdb.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 everyGinoConnection
yielded from a pool and then there be just a simpleGinoConnection.create(self, tables, **kwargs)
method that allows a user to execute DDL generated. TheAsyncSchemaGenerator
could of course be passed through from the verydb
down toGinoConnection
constructor through whatever middlewares exist:Pool
s and so on.