#!/usr/bin/env python # -*- coding: utf-8 -*- ################################################################################ # # SQLBase7-SA -- SQLAlchemy driver/dialect for Centura SQLBase v7 # Copyright © 2010 Lance Edgar # # This file is part of SQLBase7-SA. # # SQLBase7-SA is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # SQLBase7-SA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with SQLBase7-SA. If not, see . # ################################################################################ from sqlbase7_sa._version import __version__ import sqlalchemy from pkg_resources import parse_version if parse_version(sqlalchemy.__version__) <= parse_version('0.5.99'): # SQLAlchemy 0.5 doesn't support user-contributed dialects "directly" # by way of setuptools entry points, so we must monkey-patch it in # order to add ours. import sqlalchemy.databases, sqlbase7_sa, sys sqlalchemy.databases.sqlbase7 = sqlbase7_sa sys.modules['sqlalchemy.databases.sqlbase7'] = sqlbase7_sa # SQLAlchemy will be expecting us to have a 'dialect' attribute. import sqlbase7_sa.sqlbase7_sa05 dialect = sqlbase7_sa.sqlbase7_sa05.SQLBase7Dialect_SA05 else: # SQLAlchemy 0.6 is much nicer to play with. import sqlbase7_sa.sqlbase7_sa06 base = sqlbase7_sa.sqlbase7_sa06