Package Modeling :: Package DatabaseAdaptors :: Package AbstractDBAPI2AdaptorLayer :: Module AbstractDBAPI2Adaptor :: Class AbstractDBAPI2Adaptor
[show private | hide private]
[frames | no frames]

Class AbstractDBAPI2Adaptor

Adaptor --+
          |
         AbstractDBAPI2Adaptor

Known Subclasses:
MySQLAdaptor, OracleAdaptor, PostgresqlAdaptor, SQLiteAdaptor

Your inheriting concrete Adaptor class must override:

Plus the two following methods, for use by the inherited methods:


Method Summary
  assertConnectionDictionaryIsValid(self)
See Modeling.interfaces.Adaptor for details
  assignExternalInfoForAttribute(self, anAttribute)
See Modeling.interfaces.Adaptor for details
  assignExternalInfoForEntity(self, anEntity)
See Modeling.interfaces.Adaptor for details
  createAdaptorContext(self)
Creates and return an instance of the concrete AdaptorContext in relation to your concrete Adaptor.
  createDatabaseWithAdministrativeConnectionDictionary(self, administrativeConnectionDictionary, createUserFlag)
TBD...
  dbAPI_connectionDictionaryForConnect(self, aModelConnectionDictionary)
Returns the connection dictionary to be used with the underlying python DB-API v2.0-compliant db-adaptor's connect().
  dbAPI_gimmeCnxAndCursorForDBAdmin(self, administrativeConnectionDictionary)
Returns a connection object (opened using the administrativeConnectionDictionary) and a cursor adequate to perform adminstrative tasks on the database (i.e., mainly, adequate to create or drop databases).
  defaultExpressionClass(self)
See Modeling.interfaces.Adaptor for details
  dropDatabaseWithAdministrativeConnectionDictionary(self, administrativeConnectionDictionary, dropUserFlag)
TBD...
  expressionFactory(self)
See Modeling.interfaces.Adaptor for details
  externalTypesWithModel(self, aModel)
See Modeling.interfaces.Adaptor for details
  fetchedValueForDataValue(self, value, anAttribute)
See Modeling.interfaces.Adaptor for details
  fetchedValueForDateValue(self, value, anAttribute)
See Modeling.interfaces.Adaptor for details
  fetchedValueForNumberValue(self, value, anAttribute)
See Modeling.interfaces.Adaptor for details
  fetchedValueForStringValue(self, value, anAttribute)
See Modeling.interfaces.Adaptor for details
  fetchedValueForValue(self, value, anAttribute)
See Modeling.interfaces.Adaptor for details
  internalTypeForExternalType(self, extType, aModel)
See Modeling.interfaces.Adaptor for details
  isValidQualifierType(self, typeName, aModel)
See Modeling.interfaces.Adaptor for details
  schemaGenerationFactory(self)
Returns an instance of the concrete SchemaGeneration class.
  underlying_py_adaptor_module()
Returns the underlying python DB-API v2.0-compliant db-adaptor module (Static method)
    Inherited from Adaptor
  __init__(self, name)
See interfaces.Adaptor for details
  __unimplemented__(self)
  adaptorWithModel(aModel)
Returns the adaptor associated to the supplied model: it extracts the name of the adaptor to be used with the model then calls adaptorWithModel() Raises ValueError is parameter 'aModel' is None or if its adaptorName is empty. (Static method)
  adaptorWithName(aName)
Returns the adaptor. (Static method)
  administrativeConnectionDictionaryForAdaptor(self, anAdaptor)
See interfaces.Adaptor for details
  assignExternalInfoForEntireModel(self, aModel)
See interfaces.Adaptor for details
  assignExternalTypeForAttribute(self, anAttribute)
See interfaces.Adaptor for details
  canServiceModel(self, aModel)
Compares 'aModel' 's connectionDictionary with self's and returns the result
  connectionDictionary(self)
Returns the connectionDictionary
  contexts(self)
Returns all AdaptorContexts created and registered with this Adaptor
  defaultDelegate()
Returns the default delegate. (Static method)
  delegate(self)
Returns the delegate for that Adaptor ; when initialized the delegate is the one returned by defaultDelegate()
  expressionClass(self)
Returns the expression class to be used with the Adaptor.
  expressionClassForAdaptor(adaptor)
Returns the expression class to be used by adaptor, or None if none was previously set with 'setExpressionClassForAdaptor()'. (Static method)
  handleDroppedConnection(self)
Unimplemented yet
  hasOpenChannels(self)
Forwards the messages to all contexts() and returns 1 (true value) if at least one of these returned a true value, return 0 (false value) otherwise.
  isDroppedConnectionException(self, exception)
See interfaces.Adaptor for details
  name(self)
Returns the name that was used when the concrete Adaptor was instanciated.
  prototypeAttributes(self)
See interfaces.Adaptor for details
  setConnectionDictionary(self, connectionDictionary)
Sets the connectionDictionary.
  setDefaultDelegate(delegate)
Sets the default delegate which is assigned to Adaptor instances when they are initialized. (Static method)
  setDelegate(self, aDelegate)
Sets the delegate (not used yet)
  setExpressionClassForAdaptor(sqlExpression, adaptor)
Sets the SQLExpression to use in conjonction with a particular adaptor. (Static method)

Class Variable Summary
tuple __implements__ = (<class Modeling.interfaces.Adaptor.IAd...
    Inherited from Adaptor
str __raise_exception__ = 'AbstractMethod'
str __raise_msg__ = 'Left intentionally unimplemented in thi...

Instance Method Details

assertConnectionDictionaryIsValid(self)

See Modeling.interfaces.Adaptor for details
Overrides:
Modeling.Adaptor.Adaptor.assertConnectionDictionaryIsValid

assignExternalInfoForAttribute(self, anAttribute)

See Modeling.interfaces.Adaptor for details
Overrides:
Modeling.Adaptor.Adaptor.assignExternalInfoForAttribute

assignExternalInfoForEntity(self, anEntity)

See Modeling.interfaces.Adaptor for details
Overrides:
Modeling.Adaptor.Adaptor.assignExternalInfoForEntity

createAdaptorContext(self)

Creates and return an instance of the concrete AdaptorContext in relation to your concrete Adaptor.

Implementation hint: say your adaptor's name is 'Dummy', then you'll

probably use the following code:

from DummyAdaptorContext import DummyAdaptorContext
concreteAdaptorContext=DummyAdaptorContext(self)
self._contexts.append(concreteAdaptorContext)
return concreteAdaptorContext
--> It is very important that you do not forget to append the adaptor
context to the list of 'self._contexts'

Subclasses should override this method without calling the superclass' implementation.

Overrides:
Modeling.Adaptor.Adaptor.createAdaptorContext

createDatabaseWithAdministrativeConnectionDictionary(self, administrativeConnectionDictionary, createUserFlag=0)

TBD
See also:
  SchemaGeneration.createDatabaseStatementsForConnectionDictionary()
Overrides:
Modeling.Adaptor.Adaptor.createDatabaseWithAdministrativeConnectionDictionary

dbAPI_connectionDictionaryForConnect(self, aModelConnectionDictionary)

Returns the connection dictionary to be used with the underlying python DB-API v2.0-compliant db-adaptor's connect(). The returned dictionary will be passed as keyword to the connect() method (e.g.: 'apply(connect, (), returnedDict)').

Subclasses should override this method without calling the superclass' implementation.

Parameter:

aModelConnectionDictionary -- a dictionary made of the following keys:
'host', 'database', 'user' and 'password' (see also: Modeling.Model.connectionDictionary())

dbAPI_gimmeCnxAndCursorForDBAdmin(self, administrativeConnectionDictionary)

Returns a connection object (opened using the administrativeConnectionDictionary) and a cursor adequate to perform adminstrative tasks on the database (i.e., mainly, adequate to create or drop databases).

Note that depending on the underlying adaptor and the corresponding database, this can be more or less easy to provide. For example, Postgresql db does not allow any SQL statement like 'CREATE DATABASE' to be executed while a transaction is opened. Since the python DB-API implicitly requires that a transaction is automatically opened, a simple connect is not sufficient. To continue with postgresql, the python module 'psycopg' offers an 'autocommit()' method on connection to toggle the automatic opening of a transaction, while the 'pgdb' module requires some additional work with its underlying '_pg' module.

Subclasses should override this method without calling the superclass' implementation.

Parameter:

administrativeConnectionDictionary -- a dictionary made of the following
keys: 'host', 'database', 'user' and 'password' (see also: Modeling.Model.connectionDictionary()).

defaultExpressionClass(self)

See Modeling.interfaces.Adaptor for details
Overrides:
Modeling.Adaptor.Adaptor.defaultExpressionClass

dropDatabaseWithAdministrativeConnectionDictionary(self, administrativeConnectionDictionary, dropUserFlag=0)

TBD
See also:
  SchemaGeneration.dropDatabaseStatementsForConnectionDictionary()
Overrides:
Modeling.Adaptor.Adaptor.dropDatabaseWithAdministrativeConnectionDictionary

expressionFactory(self)

See Modeling.interfaces.Adaptor for details
Overrides:
Modeling.Adaptor.Adaptor.expressionFactory

externalTypesWithModel(self, aModel)

See Modeling.interfaces.Adaptor for details
Overrides:
Modeling.Adaptor.Adaptor.externalTypesWithModel

fetchedValueForDataValue(self, value, anAttribute)

See Modeling.interfaces.Adaptor for details
Overrides:
Modeling.Adaptor.Adaptor.fetchedValueForDataValue

fetchedValueForDateValue(self, value, anAttribute)

See Modeling.interfaces.Adaptor for details
Overrides:
Modeling.Adaptor.Adaptor.fetchedValueForDateValue

fetchedValueForNumberValue(self, value, anAttribute)

See Modeling.interfaces.Adaptor for details
Overrides:
Modeling.Adaptor.Adaptor.fetchedValueForNumberValue

fetchedValueForStringValue(self, value, anAttribute)

See Modeling.interfaces.Adaptor for details
Overrides:
Modeling.Adaptor.Adaptor.fetchedValueForStringValue

fetchedValueForValue(self, value, anAttribute)

See Modeling.interfaces.Adaptor for details
Overrides:
Modeling.Adaptor.Adaptor.fetchedValueForValue

internalTypeForExternalType(self, extType, aModel)

See Modeling.interfaces.Adaptor for details
Overrides:
Modeling.Adaptor.Adaptor.internalTypeForExternalType

isValidQualifierType(self, typeName, aModel)

See Modeling.interfaces.Adaptor for details
Overrides:
Modeling.Adaptor.Adaptor.isValidQualifierType

schemaGenerationFactory(self)

Returns an instance of the concrete SchemaGeneration class.

Subclasses should override this method without calling the superclass' implementation.

Overrides:
Modeling.Adaptor.Adaptor.schemaGenerationFactory

Static Method Details

underlying_py_adaptor_module()

Returns the underlying python DB-API v2.0-compliant db-adaptor module

Subclasses should override this method without calling the superclass' implementation.


Class Variable Details

__implements__

Type:
tuple
Value:
(<class Modeling.interfaces.Adaptor.IAdaptor at 0xb76e5aac>,)          

Generated by Epydoc 2.1 on Sat Mar 4 13:36:25 2006 http://epydoc.sf.net