You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/04/15 16:33:12 UTC

[GitHub] [airflow] thoralf-gutierrez commented on issue #8315: Wrong datetimes in RBAC ModelViews caused by wrong session type

thoralf-gutierrez commented on issue #8315: Wrong datetimes in RBAC ModelViews caused by wrong session type
URL: https://github.com/apache/airflow/issues/8315#issuecomment-614145127
 
 
   Ah yes that's right.
   
   If I print the details of the `db.session` that is used in the constructor of the app builder, i.e. the one that gives **incorrect** datetimes that is defined here
   
   https://github.com/apache/airflow/blob/96697180d79bfc90f6964a8e99f9dd441789177c/airflow/www_rbac/app.py#L103-L108
   
   I get :
   ```
   db.session = <sqlalchemy.orm.scoping.scoped_session object at 0x7f4037339d30>
   db.session.__dict__ = {
     'session_factory': sessionmaker(
       class_='SignallingSession',
       db=<SQLA engine=mysql+mysqldb://user:***@host/airflow_db?charset=utf8>,
       query_cls=<class 'flask_sqlalchemy.BaseQuery'>,
       bind=None,
       autoflush=True,
       autocommit=False,
       expire_on_commit=True),
     'registry': <sqlalchemy.util._collections.ScopedRegistry object at 0x7f4037339e10>
   }
   ```
   
   If I print the details of the session in `/last_dagruns`, i.e. the one that gives the **correct** datetimes provided here
   
   https://github.com/apache/airflow/blob/96697180d79bfc90f6964a8e99f9dd441789177c/airflow/www_rbac/views.py#L474-L483
   
   I get:
   
   ```
   session = <sqlalchemy.orm.session.Session object at 0x7f40360ad828>
   session.__dict__ = {
     '_identity_cls': <class 'sqlalchemy.orm.identity.WeakInstanceDict'>,
     'identity_map': <sqlalchemy.orm.identity.WeakInstanceDict object at 0x7f40360ad160>,
     '_new': {},
     '_deleted': {},
     'bind': Engine(mysql+mysqldb://user:***@host/airflow_db),
     '_Session__binds': {},
     '_flushing': False,
     '_warn_on_events': False,
     'transaction': <sqlalchemy.orm.session.SessionTransaction object at 0x7f403609e080>,
     'hash_key': 9,
     'autoflush': False,
     'autocommit': False,
     'expire_on_commit': False,
     'enable_baked_queries': True,
     '_enable_transaction_accounting': True,
     'twophase': False,
     '_query_cls': <class 'sqlalchemy.orm.query.Query'>,
     'dispatch': <sqlalchemy.event.base.SessionEventsDispatch object at 0x7f403628ca98>
   }
   ```
   
   This is the type difference I mentioned.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services