Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-352

Need help for integrating pymongo to Flask-DebugToolbar extension

    • Type: Icon: Task Task
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None

      Hello,
      I want to integrate pymongo to Flask-DebugToolbar extension. It is a port of Django debug toolbar for Flask. You can see how it looks in the attached screenshot. I need to implement the following function for displaying queries in toolbar panel. How can I do this?

      from: https://github.com/mitsuhiko/flask-sqlalchemy/blob/087c3c04a406e35a01aca8280d919eeedeec6daf/flask_sqlalchemy.py#L215

      def get_debug_queries():
      """In debug mode Flask-SQLAlchemy will log all the SQL queries sent
      to the database. This information is available until the end of request
      which makes it possible to easily ensure that the SQL generated is the
      one expected on errors or in unittesting. If you don't want to enable
      the DEBUG mode for your unittests you can also enable the query
      recording by setting the ``'SQLALCHEMY_RECORD_QUERIES'`` config variable
      to `True`. This is automatically enabled if Flask is in testing mode.

      The value returned will be a list of named tuples with the following
      attributes:

      `statement`
      The SQL statement issued

      `parameters`
      The parameters for the SQL statement

      `start_time` / `end_time`
      Time the query started / the results arrived. Please keep in mind
      that the timer function used depends on your platform. These
      values are only useful for sorting or comparing. They do not
      necessarily represent an absolute timestamp.

      `duration`
      Time the query took in seconds

      `context`
      A string giving a rough estimation of where in your application
      query was issued. The exact format is undefined so don't try
      to reconstruct filename or function name.
      """
      return getattr(connection_stack.top, 'sqlalchemy_queries', [])

            Assignee:
            Unassigned Unassigned
            Reporter:
            cenk Cenk Alti
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: