picoplex wrote:
> On Jul 1, 11:15 am, "Gaetan de Menten" <[EMAIL PROTECTED]> wrote:
>> On Tue, Jul 1, 2008 at 11:27 AM, picoplex <[EMAIL PROTECTED]> wrote:
>>
>>> I asked on the SQLAlchemy group how to execute SQL statements at
>>> application initialisation (to make the Oracle session case
>>> insensitive).
>>> I was given a snippet which involves adding listeners to the
>>> SQLAlchemy create_engine call:
>>> class MySetup:
>>> def connect(self, dbapi_con, con_record):
>>> dbapi_con.execute('alter session set NLS_SORT=BINARY_CI')
>>> dbapi_con.execute('alter session set NLS_COMP=LINGUISTIC')
>>> engine = create_engine('oracle:...', listeners=[MySetup()])
>>> How can I accomplish this when using Elixir?
>> in exactly the same way as for raw SQLAlchemy. Elixir doesn't modify
>> in any way that part of the process.
>>
>> *if* you use Elixir's provided metadata object, you can use it this way:
>>
>> elixir.metadata.bind = engine
>>
> Gaetan,
>
> Thanks - Your caution was right, I am actually using Turbogears metadata
> - I'll have to track down where create_engine is called by TG.
Listeners can also be added to the engine pool post-create if that's
more convenient. Something like this:
metadata.bind.pool.add_listener(MySetup())
# optional: reset the pool and discard any open connections
metadata.bind.dispose()
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"SQLElixir" 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/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---