kvesteri / postgresql-audit

Audit trigger for PostgreSQL
BSD 2-Clause "Simplified" License
126 stars 28 forks source link

Flask-SQLAlchemy 3.0 #65

Closed jpvanhal closed 1 year ago

jpvanhal commented 1 year ago

PostgreSQL-Audit is crashing on Flask-SQLAlchemy 3.0:

tests/test_flask_integration.py:237: in test_updating_excluded_attr_does_not_create_transaction
    client.get('/update-excluded-column')
.tox/py-sqla1.4/lib/python3.9/site-packages/werkzeug/test.py:1141: in get
    return self.open(*args, **kw)
.tox/py-sqla1.4/lib/python3.9/site-packages/flask/testing.py:223: in open
    response = super().open(
.tox/py-sqla1.4/lib/python3.9/site-packages/werkzeug/test.py:1095: in open
    response = self.run_wsgi_app(request.environ, buffered=buffered)
.tox/py-sqla1.4/lib/python3.9/site-packages/werkzeug/test.py:962: in run_wsgi_app
    rv = run_wsgi_app(self.application, environ, buffered=buffered)
.tox/py-sqla1.4/lib/python3.9/site-packages/werkzeug/test.py:1243: in run_wsgi_app
    app_rv = app(environ, start_response)
.tox/py-sqla1.4/lib/python3.9/site-packages/flask/app.py:2551: in __call__
    return self.wsgi_app(environ, start_response)
.tox/py-sqla1.4/lib/python3.9/site-packages/flask/app.py:2531: in wsgi_app
    response = self.handle_exception(e)
.tox/py-sqla1.4/lib/python3.9/site-packages/flask/app.py:2528: in wsgi_app
    response = self.full_dispatch_request()
.tox/py-sqla1.4/lib/python3.9/site-packages/flask/app.py:1825: in full_dispatch_request
    rv = self.handle_user_exception(e)
.tox/py-sqla1.4/lib/python3.9/site-packages/flask/app.py:1823: in full_dispatch_request
    rv = self.dispatch_request()
.tox/py-sqla1.4/lib/python3.9/site-packages/flask/app.py:1799: in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
tests/test_flask_integration.py:231: in test_update_excluded_column
    db.session.commit()
<string>:2: in commit
    ???
.tox/py-sqla1.4/lib/python3.9/site-packages/sqlalchemy/orm/session.py:1451: in commit
    self._transaction.commit(_to_root=self.future)
.tox/py-sqla1.4/lib/python3.9/site-packages/sqlalchemy/orm/session.py:829: in commit
    self._prepare_impl()
.tox/py-sqla1.4/lib/python3.9/site-packages/sqlalchemy/orm/session.py:808: in _prepare_impl
    self.session.flush()
.tox/py-sqla1.4/lib/python3.9/site-packages/sqlalchemy/orm/session.py:3446: in flush
    self._flush(objects)
.tox/py-sqla1.4/lib/python3.9/site-packages/sqlalchemy/orm/session.py:3475: in _flush
    self.dispatch.before_flush(self, flush_context, objects)
.tox/py-sqla1.4/lib/python3.9/site-packages/sqlalchemy/event/attr.py:247: in __call__
    fn(*args, **kw)
postgresql_audit/base.py:370: in receive_before_flush
    self.set_activity_values(session)
postgresql_audit/base.py:310: in set_activity_values
    dialect = session.bind.engine.dialect
E   AttributeError: 'NoneType' object has no attribute 'engine'