Extension Point : IDatabaseConnector
The IDatabaseConnector allows supporting different database backends.
Trac provides generic database abstraction layer, allowing extensible support for different database backends. This allows Trac to be used with either SQLite, MySQL, PostgreSQL or any other database for which a connector is available.
Typically, an implementation checks if any required binding libraries are available when loaded. On failure, an error can be indicated when Trac queries the supported schemes. The schema of the database connection string selects the appropriate implementation to be used.
Primarily, the implementation then provides Python DB API 2.0 connection and cursor objects for that connection string. Typically a
ConnectionWrapper is used to wrap the connection object of the specific db library.
Implementations also initialize and backup a database, and generate implementation specific DDL and SQL for poorly standardized features (like type casting, string concatenation, pattern matching, accessing the last row id).
Due to the complexity of implementing a full database backend, no simple example can be provided here.
- Official Trac connectors
Additional Information and References
- API Reference
- Tickets relating to:
- About connectors for other databases