Skip to content

Database profiler - Integration with SQLTap #412

@tng10

Description

@tng10

Hi, I am trying to integrate SQLTap into a project with Sanic and GINO.

  • GINO version: 0.8.0
  • Python version: 3.6.6
  • asyncpg version: 0.17.0
  • aiocontextvars version: 0.2.0
  • PostgreSQL version: 10.6

Description

I am basically using the most basic example of SQLTap, which is the following:

import sqltap

async def get_users():
    profiler = sqltap.start()
    all_users = await User.query.gino.all()
    statistics = profiler.collect()
    sqltap.report(statistics, "report.html")
    return all_users

What is going on behind the scenes on SQLTap is the class QueryStats is being instantiated and the parameter results which is suppose to be an instance of sqlalchemy.engine.ResultProxy, actually is a instance of gino.dialects.base._ResultProxy. I did a very basic comparison between ResultProxy class from SQLAlchemy and _ResultProxy class from Gino and I noticed there are methods/attributes omitted. Is there any reason to not have these attributes there? Is there a way to access the ResultProxy instance from SQLAlchemy?

When I execute this code, I receive the error described underneath.

Traceback

  File "/home/jclacerda/PycharmProjects/dgae/colombus/venv/lib/python3.6/site-packages/sqltap/sqltap.py", line 63, in __init__
    self.rowcount = results.rowcount
AttributeError: '_ResultProxy' object has no attribute 'rowcount'

Thank you!

Metadata

Metadata

Assignees

Labels

bugDescribes a bug in the system.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions