Re: [sqlalchemy] Multiple sessions same thread - How to?

2018-06-21 Thread Jonathan Vanasco
On Thursday, June 21, 2018 at 10:02:27 PM UTC-4, HP3 wrote: > > What's the correct way to create a session that is not automatically bound > to any transaction or that can be explicitly bound to an isolated > transaction that can be committed whenever? > That's what `Session()` does by

Re: [sqlalchemy] Multiple sessions same thread - How to?

2018-06-21 Thread HP3
Thank you Mike!!! Sorry about that - my example had errors :( In reality, I am calling `celery_state_session.flush()` and `celery_state_session.commit()` right after I update any of the `cs.` values. @app.task( base=BaseTask, bind=True ) def my_task(self, ...): # Persist

Re: [sqlalchemy] How to use labels directly in compare expression

2018-06-21 Thread Mike Bayer
Did you try using the code object itself? There's some dialect-specific rules for when it rewrites the expression vs. uses the label name in the expression but it may work (am traveling and can't check the code right now) On Thu, Jun 21, 2018, 10:10 AM wrote: > Hi, > > I want to translate

Re: [sqlalchemy] Multiple sessions same thread - How to?

2018-06-21 Thread Mike Bayer
>From looking at your code example, I don't see you calling celery_session.flush() or celery_session.commit(), so nothing is going to persist. Just setting an attribute value does not send any SQL. On Thu, Jun 21, 2018, 7:22 PM HP3 wrote: > Hello all: > > Within a celery task, I need to have 2

[sqlalchemy] Multiple sessions same thread - How to?

2018-06-21 Thread HP3
Hello all: Within a celery task, I need to have 2 unrelated sessions that can commit/rollback independently of each other: One session (`domain_model_session`) performs vanilla domain model operations and the other (`celery_state_session`) is to persist the state of the celery task itself

Re: [sqlalchemy] Hanging on _get_constraint_data with schema of type unicode

2018-06-21 Thread Mike Bayer
There's a known behavior in oracle that some indexes fail to function against Unicode strings, the solution may involve special casts or some such but we would need to research this. Please post an issue with as much as you can learn about this issue (including how to workaround) at

[sqlalchemy] Hanging on _get_constraint_data with schema of type unicode

2018-06-21 Thread Vinit Shah
I've posted this on stackoverflow , but I may have more luck here. I'm using SqlAlchemy's autoload feature to load up table data. Recently, after an upgrade to Oracle

[sqlalchemy] How to use labels directly in compare expression

2018-06-21 Thread yoch . melka
Hi, I want to translate this MariaDB query to sqlalchemy : SELECT JSON_VALUE(user.meta, '$.code') AS code FROM user HAVING code IS NOT NULL; (Note: the use of HAVING is because I want to filter on the alias `code`.) I don't find a simple way to use the alias in comparison, currently I wrote