예제 #1
0
    def __init__(self, session):
        if session.weak_identity_map:
            self.identity_map = attributes.InstanceDict()
        else:
            self.identity_map = {}

        self.new = util.Set()  #OrderedSet()
        self.deleted = util.Set()
        self.logger = logging.instance_logger(self, echoflag=session.echo_uow)
예제 #2
0
 def __init__(self, creator, recycle=-1, echo=None, use_threadlocal=False, auto_close_cursors=True, disallow_open_cursors=False):
     self.logger = logging.instance_logger(self)
     self._threadconns = weakref.WeakValueDictionary()
     self._creator = creator
     self._recycle = recycle
     self._use_threadlocal = use_threadlocal
     self.auto_close_cursors = auto_close_cursors
     self.disallow_open_cursors = disallow_open_cursors
     self.echo = echo
예제 #3
0
    def __init__(self, session):
        if session.weak_identity_map:
            self.identity_map = attributes.WeakInstanceDict()
        else:
            self.identity_map = attributes.StrongInstanceDict()

        self.new = {}   # InstanceState->object, strong refs object
        self.deleted = {}  # same
        self.logger = logging.instance_logger(self, echoflag=session.echo_uow)
예제 #4
0
    def __init__(self, session):
        if session.weak_identity_map:
            self.identity_map = attributes.WeakInstanceDict()
        else:
            self.identity_map = attributes.StrongInstanceDict()

        self.new = {}  # InstanceState->object, strong refs object
        self.deleted = {}  # same
        self.logger = logging.instance_logger(self, echoflag=session.echo_uow)
예제 #5
0
 def __init__(self, uow, session):
     self.uow = uow
     self.session = session
     #  unique list of all the mappers we come across
     self.mappers = util.Set()
     self.dependencies = {}
     self.tasks = {}
     self.logger = logging.instance_logger(self)
     self.echo = uow.echo
     self.attributes = {}
예제 #6
0
 def __init__(self, uow, session):
     self.uow = uow
     self.session = session
     #  unique list of all the mappers we come across
     self.mappers = util.Set()
     self.dependencies = {}
     self.tasks = {}
     self.logger = logging.instance_logger(self)
     self.echo = uow.echo
     self.attributes = {}
예제 #7
0
    def __init__(self, identity_map=None, weak_identity_map=False):
        if identity_map is not None:
            self.identity_map = identity_map
        else:
            if weak_identity_map:
                self.identity_map = weakref.WeakValueDictionary()
            else:
                self.identity_map = {}

        self.new = util.Set() #OrderedSet()
        self.deleted = util.Set()
        self.logger = logging.instance_logger(self)
예제 #8
0
    def __init__(self, identity_map=None, weak_identity_map=False):
        if identity_map is not None:
            self.identity_map = identity_map
        else:
            if weak_identity_map:
                self.identity_map = weakref.WeakValueDictionary()
            else:
                self.identity_map = {}

        self.new = util.Set()  #OrderedSet()
        self.deleted = util.Set()
        self.logger = logging.instance_logger(self)
예제 #9
0
 def __init__(self,
              creator,
              recycle=-1,
              echo=None,
              use_threadlocal=False,
              auto_close_cursors=True,
              disallow_open_cursors=False):
     self.logger = logging.instance_logger(self)
     self._threadconns = weakref.WeakValueDictionary()
     self._creator = creator
     self._recycle = recycle
     self._use_threadlocal = use_threadlocal
     self.auto_close_cursors = auto_close_cursors
     self.disallow_open_cursors = disallow_open_cursors
     self.echo = echo
예제 #10
0
    def __init__(self, uow, session):
        self.uow = uow
        self.session = session
        self.mapper_flush_opts = session._mapper_flush_opts
        
        # stores tuples of mapper/dependent mapper pairs,
        # representing a partial ordering fed into topological sort
        self.dependencies = util.Set()
        
        # dictionary of mappers to UOWTasks
        self.tasks = {}
        
        # dictionary used by external actors to store arbitrary state
        # information. 
        self.attributes = {}

        self.logger = logging.instance_logger(self, echoflag=session.echo_uow)
예제 #11
0
    def __init__(self, uow, session):
        self.uow = uow
        self.session = session
        self.mapper_flush_opts = session._mapper_flush_opts

        # stores tuples of mapper/dependent mapper pairs,
        # representing a partial ordering fed into topological sort
        self.dependencies = util.Set()

        # dictionary of mappers to UOWTasks
        self.tasks = {}

        # dictionary used by external actors to store arbitrary state
        # information.
        self.attributes = {}

        self.logger = logging.instance_logger(self, echoflag=session.echo_uow)
예제 #12
0
    def __init__(self, creator, recycle=-1, echo=None, use_threadlocal=True,
                 listeners=None):
        self.logger = logging.instance_logger(self, echoflag=echo)
        # the WeakValueDictionary works more nicely than a regular dict
        # of weakrefs.  the latter can pile up dead reference objects which don't
        # get cleaned out.  WVD adds from 1-6 method calls to a checkout operation.
        self._threadconns = weakref.WeakValueDictionary()
        self._creator = creator
        self._recycle = recycle
        self._use_threadlocal = use_threadlocal
        self.echo = echo
        self.listeners = []
        self._on_connect = []
        self._on_checkout = []
        self._on_checkin = []

        if listeners:
            for l in listeners:
                self.add_listener(l)
예제 #13
0
    def __init__(self, creator, recycle=-1, echo=None, use_threadlocal=True,
                 reset_on_return=True, listeners=None):
        self.logger = logging.instance_logger(self, echoflag=echo)
        # the WeakValueDictionary works more nicely than a regular dict of
        # weakrefs.  the latter can pile up dead reference objects which don't
        # get cleaned out.  WVD adds from 1-6 method calls to a checkout
        # operation.
        self._threadconns = weakref.WeakValueDictionary()
        self._creator = creator
        self._recycle = recycle
        self._use_threadlocal = use_threadlocal
        self._reset_on_return = reset_on_return
        self.echo = echo
        self.listeners = []
        self._on_connect = []
        self._on_checkout = []
        self._on_checkin = []

        if listeners:
            for l in listeners:
                self.add_listener(l)
예제 #14
0
파일: ibm_db_sa.py 프로젝트: exedre/ibm-db
def descriptor():
  """A module-level function that is used by the engine to obtain information
     about adapter. It is designed to be used in automated configuration 
     tools that wish to query the user for database and connection information.
     Returns: dictionary with the following key/value pairs:
              name:  name of the engine, suitable for use in the create_engine function
              description:  plain description of the engine.
              arguments:  dictionary describing the name and description 
                          of each parameter used to connect to the underlying DB-API.
  """
  return { 'name': 'ibm_db_sa',
           'description': 'SQLAlchemy support for IBM Data Servers',
           'arguments': [ ('database', 'Database Name', None),
                          ('schema', 'Schema name', None),
                          ('host', 'Host name', None),
                          ('port', 'Port number', None),
                          ('user', 'Username', None),
                          ('password', 'Password', None)
                         ]
          }

# Set IBM_DBDialect instance attributes: SchemaGenerator, SchemaDropper,
# DefaultRunner, Compiler, IdentifierPreparer, logger
dialect = IBM_DBDialect
dialect.schemagenerator = IBM_DBSchemaGenerator
dialect.schemadropper = IBM_DBSchemaDropper
dialect.defaultrunner = IBM_DBDefaultRunner
dialect.statement_compiler = IBM_DBCompiler
dialect.preparer = IBM_DBIdentifierPreparer
dialect.logger = logging.instance_logger(dialect, echoflag=False)
예제 #15
0
    """A module-level function that is used by the engine to obtain information
     about adapter. It is designed to be used in automated configuration 
     tools that wish to query the user for database and connection information.
     Returns: dictionary with the following key/value pairs:
              name:  name of the engine, suitable for use in the create_engine function
              description:  plain description of the engine.
              arguments:  dictionary describing the name and description 
                          of each parameter used to connect to the underlying DB-API.
  """
    return {
        'name':
        'ibm_db_sa',
        'description':
        'SQLAlchemy support for IBM Data Servers',
        'arguments':
        [('database', 'Database Name', None), ('schema', 'Schema name', None),
         ('host', 'Host name', None), ('port', 'Port number', None),
         ('user', 'Username', None), ('password', 'Password', None)]
    }


# Set IBM_DBDialect instance attributes: SchemaGenerator, SchemaDropper,
# DefaultRunner, Compiler, IdentifierPreparer, logger
dialect = IBM_DBDialect
dialect.schemagenerator = IBM_DBSchemaGenerator
dialect.schemadropper = IBM_DBSchemaDropper
dialect.defaultrunner = IBM_DBDefaultRunner
dialect.statement_compiler = IBM_DBCompiler
dialect.preparer = IBM_DBIdentifierPreparer
dialect.logger = logging.instance_logger(dialect, echoflag=False)
예제 #16
0
 def __init__(self, connection_provider, dialect, echo=None):
     self.connection_provider = connection_provider
     self.dialect = dialect
     self.echo = echo
     self.logger = logging.instance_logger(self)
예제 #17
0
 def __init__(self, connection_provider, dialect, echo=None):
     self.connection_provider = connection_provider
     self.dialect=dialect
     self.echo = echo
     self.logger = logging.instance_logger(self)