def setup_engine(self, metadata=None, session=None, entities=[]): """ 2008-10-09 a common theme for all other databases """ from elixir.options import using_table_options_handler if getattr(self, 'schema', None): #for postgres for entity in entities: if entity.__module__==self.__module__: #entity in the same module using_table_options_handler(entity, schema=self.schema) #2008-10-05 MySQL typically close connections after 8 hours resulting in a "MySQL server has gone away" error. metadata.bind = create_engine(self._url, pool_recycle=self.pool_recycle, echo=self.sql_echo) #, convert_unicode=True, encoding="utf8") self.metadata = metadata self.session = session
def setup_engine(self, metadata=None, session=None, entities=[]): """ 2008-10-09 a common theme for all other databases """ from elixir.options import using_table_options_handler if getattr(self, 'schema', None): #for postgres for entity in entities: if entity.__module__==self.__module__: #entity in the same module using_table_options_handler(entity, schema=self.schema) #2012.5.16 this changes the entity._descriptor.table_fullname #if self.schema!='public': # entity._descriptor.tablename = '%s.%s'%(self.schema, entity._descriptor.tablename) #2012.5.16 change the tablename #2008-10-05 MySQL typically close connections after 8 hours resulting in a "MySQL server has gone away" error. metadata.bind = create_engine(self._url, pool_recycle=self.pool_recycle, echo=self.sql_echo) #, convert_unicode=True, encoding="utf8") self.metadata = metadata self.session = session #2012.12.28 self.cleanUpMetadatas()
def __init__(self, **keywords): """ 2008-08-26 """ from pymodule import ProcessOptions ProcessOptions.process_function_arguments( keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self ) if self.debug: import pdb pdb.set_trace() if getattr(self, "schema", None): # for postgres for entity in entities: if entity.__module__ == self.__module__: # entity in the same module using_table_options_handler(entity, schema=self.schema) __metadata__.bind = self._url self.metadata = __metadata__ self.session = __session__