Re: [sqlalchemy] Inject/Extend an attribute onto all objects in a Session?

2016-10-27 Thread mike bayer
On 10/27/2016 09:41 PM, Jonathan Vanasco wrote: I have an edge-case in a few situations where, within an @property of a SqlAlchemy object, I need to know the current active web-request/context. I'm currently using Pyramid's `get_current_request`, but it is no longer recommended -- so I'd like

[sqlalchemy] Inject/Extend an attribute onto all objects in a Session?

2016-10-27 Thread Jonathan Vanasco
I have an edge-case in a few situations where, within an @property of a SqlAlchemy object, I need to know the current active web-request/context. I'm currently using Pyramid's `get_current_request`, but it is no longer recommended -- so I'd like to get a proper solution in place. I have a new

Re: [sqlalchemy] Rolling back transactions across flushes?

2016-10-27 Thread mike bayer
On 10/27/2016 05:13 PM, Zach wrote: Hi, I'd really appreciate some assistance with the below issue. Rolling back sqlalchemy transactions cross-flush currently appears impossible to me. It’s necessary if you want to issue queries that rely on the presence of an assigned primary key identifier

Re: [sqlalchemy] Creating a transient model with a many-to-many relationship

2016-10-27 Thread mike bayer
you'd say: session.expire(model, ["items"]) On 10/27/2016 04:47 PM, Colton Allen wrote: Sorry I must have combined multiple attempts into one example. When you say expire the relationship, what do you mean? On Thursday, October 27, 2016 at 4:30:36 PM UTC-4, Mike Bayer wrote: Hello -

[sqlalchemy] Re: Rolling back transactions across flushes?

2016-10-27 Thread Colton Allen
Try closing the session. I've used similar code in my projects. Also if you're using SQLite you need to do some additional tweaking so that it understands the transaction. def setUp(self): self.session = sessionmaker(bind=engine)() self.session.begin_nested() def tearDown(self):

[sqlalchemy] Rolling back transactions across flushes?

2016-10-27 Thread Zach
Hi, I'd really appreciate some assistance with the below issue. Rolling back sqlalchemy transactions cross-flush currently appears impossible to me. It’s necessary if you want to issue queries that rely on the presence of an assigned primary key identifier (adding something to the session

Re: [sqlalchemy] Creating a transient model with a many-to-many relationship

2016-10-27 Thread mike bayer
Hello - I've rebuilt your fragment into a full example in order to determine what the behavior is here, as make_transient() has no defined behavior for loaded relationships. Your error does not reproduce with your code fragment as given, because you are setting the list of items to itself,

Re: [sqlalchemy] similar to OrderingList but order in code instead of via sql?

2016-10-27 Thread mike bayer
works for me! at least I have the plan for the next time this comes up. On 10/27/2016 12:42 PM, Paul Winkler wrote: Wow, thanks for the very detailed reply Mike! This is rather anticlimactic followup I'm afraid :) But we mulled this over a bit and just slapped an index on the column in

[sqlalchemy] Creating a transient model with a many-to-many relationship

2016-10-27 Thread Colton Allen
I want to create a new row with all of the same data. However, (using make_transient) the many-to-many "items" relationship doesn't carry over to the new model. When I manually set the items I recieve a "StaleDataError". How can I insert the many-to-many relationships so this does not

Re: [sqlalchemy] similar to OrderingList but order in code instead of via sql?

2016-10-27 Thread Paul Winkler
Wow, thanks for the very detailed reply Mike! This is rather anticlimactic followup I'm afraid :) But we mulled this over a bit and just slapped an index on the column in question instead. - Paul On Wednesday, October 26, 2016 at 9:19:23 PM UTC-4, Mike Bayer wrote: > > > > On 10/26/2016 05:50

[sqlalchemy] SQLAlchemy 1.1.3 Released

2016-10-27 Thread mike bayer
SQLAlchemy release 1.1.3 is now available. Release 1.1.3 continues a series of very fast releases since 1.1.0 was first released, containing fixes for several more small regressions. As is usually the case with such regressions, each one involves an unanticipated use case so are not

Re: [sqlalchemy] sqlalchemy with airflow and Oracle

2016-10-27 Thread Vincent B.
Editing the source code from "SELECT 1" to "SELECT 1 FROM DUAL" actually fixed everything. It is a less than satisfactory solution so i will contact the dev of Airflow to update the *pessimistic_connection_handling *code with the newer version as you suggested. So it was the sqlalchemy

Re: [sqlalchemy] sqlalchemy with airflow and Oracle

2016-10-27 Thread Vincent B.
Thanks for this very detailled answer! It will take some time for me to investigate this. By the way Airflow Airbnb is a great solution but still very new and a bit buggy. On Thursday, October 27, 2016 at 2:42:28 PM UTC+2, Mike Bayer wrote: > > So the test against plain cx_Oracle is a datapoint

Re: [sqlalchemy] Union on relationship

2016-10-27 Thread mike bayer
On 10/26/2016 10:40 PM, Alfred Soeng wrote: Hi Mike, Are you free to talk through the fb messenger about my issue if you are good to it? Hi Alfred - unfortunately my time is limited to being able to answer isolated questions on this list. However, there are a handful of people you can

Re: [sqlalchemy] sqlalchemy with airflow and Oracle

2016-10-27 Thread mike bayer
So the test against plain cx_Oracle is a datapoint sure, but since you say that connects, we need to look at what your application is doing. The first thing I see in the stack trace is that the application is raising a sqlalchemy.exc.DisconnectionError. This is an exception that SQLAlchemy

Re: [sqlalchemy] sqlalchemy with airflow and Oracle

2016-10-27 Thread Vincent B.
Thanks again. So i configured several pool_timeout ranging from 0.01 to 30 and i still get this *This connection is closed * Is there a way to have more details regarding my sqlalchemy connection? I am already using *echo=True*, *echo_pool=True* and Python's logging logging.basicConfig()