Audit chokes in real-world use
When trying to run an audit query against an installed configdb with SQLAlchemy backend, the audit function raises an exception when calling SQLAlchemy. The problem seems to lie in the following line of AdmDbApi.get_audit :
return session.execute(
audit_table.select().where(sql_query).order_by('stamp desc'))
How to reproduce:
The client runs an audit query against a running configdb-api-server
, e.g.
configdb-client --url=http://localhost:3000 audit --entity ENTITY_NAME
and this results in the following stack trace:
ERROR:configdb.server.wsgiapp:exception in url=http://localhost:3000/audit Traceback (most recent call last): File "/home/joe/inventory-virtualenv/local/lib/python2.7/site-packages/configdb-0.2-py2.7.egg/configdb/server/wsgiapp.py", line 66, in _json_response_wrapper 'result': fn(*args, **kwargs)}) File "/home/joe/inventory-virtualenv/local/lib/python2.7/site-packages/configdb-0.2-py2.7.egg/configdb/server/wsgiapp.py", line 182, in get_audit for x in g.api.get_audit(g.request_data, g.auth_ctx)] File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 3051, in __iter__ row = self.fetchone() File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 3250, in fetchone self.cursor, self.context) File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1819, in _handle_dbapi_exception self.dialect.is_disconnect(e, self.__connection, cursor) AttributeError: 'Connection' object has no attribute '_Connection__connection'