<s> from __future__ import absolute_import <EOL> import os <EOL> from sqlalchemy import create_engine , Column , String , Integer , DateTime <EOL> from sqlalchemy . ext . declarative import declarative_base <EOL> from architect import install <EOL> databases = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } <EOL> dsn = databases [ os . environ . get ( '<STR_LIT>' ) ] <EOL> engine = create_engine ( dsn ) <EOL> Base = declarative_base ( ) <EOL> for item in ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) : <EOL> name = '<STR_LIT>' . format ( item . capitalize ( ) ) <EOL> partition = install ( '<STR_LIT>' , type = '<STR_LIT>' , subtype = '<STR_LIT:date>' , constraint = item , column = '<STR_LIT>' , db = engine . url ) <EOL> locals ( ) [ name ] = partition ( type ( name , ( Base , ) , { <EOL> '<STR_LIT>' : '<STR_LIT>' . format ( item ) , <EOL> '<STR_LIT:id>' : Column ( Integer , primary_key = True ) , <EOL> '<STR_LIT:name>' : Column ( String ( length = <NUM_LIT:255> ) ) , <EOL> '<STR_LIT>' : Column ( DateTime , nullable = True ) <EOL> } ) ) <EOL> if os . environ . get ( '<STR_LIT>' ) in ( '<STR_LIT>' , '<STR_LIT>' ) : <EOL> for item in ( '<STR_LIT:2>' , '<STR_LIT:5>' ) : <EOL> name = '<STR_LIT>' . format ( item ) <EOL> partition = install ( '<STR_LIT>' , type = '<STR_LIT>' , subtype = '<STR_LIT>' , constraint = item , column = '<STR_LIT>' , db = engine . url ) <EOL> locals ( ) [ name ] = partition ( type ( name , ( Base , ) , { <EOL> '<STR_LIT>' : '<STR_LIT>' . format ( item ) , <EOL> '<STR_LIT:id>' : Column ( Integer , primary_key = True ) , <EOL> '<STR_LIT:name>' : Column ( String ( length = <NUM_LIT:255> ) ) , <EOL> '<STR_LIT>' : Column ( Integer , nullable = True ) <EOL> } ) ) <EOL> for subtype in ( '<STR_LIT>' , '<STR_LIT>' ) : <EOL> for item in ( '<STR_LIT:2>' , '<STR_LIT:5>' ) : <EOL> name = '<STR_LIT>' . format ( '<STR_LIT>' . join ( s . capitalize ( ) for s in subtype . split ( '<STR_LIT:_>' ) ) , item ) <EOL> partition = install ( '<STR_LIT>' , type = '<STR_LIT>' , subtype = subtype , constraint = item , column = '<STR_LIT:title>' , db = engine . url ) <EOL> locals ( ) [ name ] = partition ( type ( name , ( Base , ) , { <EOL> '<STR_LIT>' : '<STR_LIT>' . format ( subtype , item ) , <EOL> '<STR_LIT:id>' : Column ( Integer , primary_key = True ) , <EOL> '<STR_LIT:name>' : Column ( String ( length = <NUM_LIT:255> ) ) , <EOL> '<STR_LIT:title>' : Column ( String ( length = <NUM_LIT:255> ) , nullable = True ) <EOL> } ) ) <EOL> Base . metadata . create_all ( engine ) </s>
