I would like to change SA to support the embedded version of Firebird SQL.
I am close but the process does not terminate correctly (i.e. I have to
kill it), so I am obviously missing something.
I made the following change to firebird.py (SA 0.4.0 final):
def create_connect_args(self, url):
opts = url.translate_connect_args(username='user')
if opts.get('port'):
opts['host'] = "%s/%s" % (opts['host'], opts['port'])
del opts['port']
opts.update(url.query)
print opts
print opts['host']
if opts['host'] == 'embedded':
del opts['host']
print opts
type_conv = opts.pop('type_conv', self.type_conv)
Then running the following:
import sqlalchemy as sa
import sqlalchemy.orm as sao
import model as db
import utils
database = u'C:\\Dev\\twcb\\Data\\twcb3.fdb'
host = 'embedded'
fileurl = str(database.replace('\\', '/'))
url = 'firebird://USERNAME:[EMAIL PROTECTED]/%s' % (host, fileurl)
dburl = sa.engine.url.make_url(url)
engine = sa.create_engine(dburl, encoding='utf8', echo=False)
Session = sao.sessionmaker(autoflush=True, transactional=True)
Session.configure(bind=engine)
session = Session()
dbItemConsumption = session.query(db.Consumption).load(63)
print dbItemConsumption.consumptionid
print dbItemConsumption.consumedvalue
print dbItemConsumption.updated
session.close()
Gives me the correct output, i.e.:
{'host': 'embedded', 'password': 'pw', 'user': 'USERNAME', 'database':
'C:/Dev/twcb/Data/twcb3.fdb'}
embedded
{'password': 'pw', 'user': 'USERNAME', 'database':
'C:/Dev/twcb/Data/twcb3.fdb'}
63
7.5
2007-11-09
However the process hangs and I have to manually kill it.
Can anyone help me pinpoint what else needs to be changed?
If this works correctly would a patch be accepted?
Best regards
Werner
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---