ephraimbuddy commented on PR #42928:
URL: https://github.com/apache/airflow/pull/42928#issuecomment-2407493946

   > > This PR brings back the old behaviour of using different sessions for 
writing/deleting RTIFs
   > 
   > I think has continued to use the same session. Pretty sure that the 
difference is pre-AIP-44 we committed in between.
   > 
   > Here's a way to explore:
   > 
   > ```
   > session.execute("create table parent(id int);");
   > session.commit()
   > session.execute("insert into parent (id) values (1),(2),(3);")
   > with create_session() as session2:
   >     print(session2.execute("select * from parent").all())
   > assert session2 is session
   > ```
   > 
   
   
   Yeah, Issuing a commit persists things into the DB, not that the session is 
different.
   
   > Why this matters?
   > 
   > I feel like it's better to commit explicitly so that we _see_ it. Rather 
than having it done invisibly by the decorator.
   
   The provide session is already doing that? Or you want it removed from the 
RTIF write method? I feel it's a better design to have the provide_session do 
it than 
   ```
   RTIF.write(session)
   session.commit()
   RTIF.delete_old_record(session)
   session.commit()
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to