예제 #1
0
파일: lib.py 프로젝트: kreopt/aioweb
def init_orator(settings):
    import yaml
    from orator import DatabaseManager
    from orator import Model
    dbconfig = get_dbconfig(settings)

    if Model.get_connection_resolver():
        Model.get_connection_resolver().disconnect()
    Model.set_connection_resolver(DatabaseManager(dbconfig))
예제 #2
0
    def test_reconnection(self):
        db = Model.get_connection_resolver()

        db.disconnect()
        db.reconnect()

        db.disconnect()
예제 #3
0
    def test_reconnection(self):
        db = Model.get_connection_resolver()

        db.disconnect()
        db.reconnect()

        db.disconnect()
예제 #4
0
 def setUp(self):
     connection = Model.get_connection_resolver().connection()
     schema = connection.get_schema_builder()
     with schema.create('users') as table:
         table.increments('id')
         table.string('name').unique()
         table.string('email').unique()
         table.boolean('admin').default(True)
         table.timestamps()
예제 #5
0
 def connection(self):
     return Model.get_connection_resolver().connection()
예제 #6
0
 def connection(self):
     return Model.get_connection_resolver().connection()
예제 #7
0
파일: __init__.py 프로젝트: zehauser/orator
 def connection(self, connection=None):
     return Model.get_connection_resolver().connection(connection)