Giter VIP home page Giter VIP logo

Comments (4)

mgood avatar mgood commented on July 20, 2024

I wasn't able to reproduce this in my test app using SQLite. Can you provide some more details on your app & environment, including the versions of Flask-SQLAlchemy and SQLAlchemy you're using and the database driver used. It might also help to narrow it down to a small test app that exhibits the problem, such as if it happens to occur only with custom SQL queries instead of SQLAlchemy ORM queries.

from flask-debugtoolbar.

aoghina avatar aoghina commented on July 20, 2024

Sorry for the late reply, I'm using MySQL 5.5.34 and Python 3.3.1 on Ubuntu 13.04, here are some details:

Flask==0.10.1
Flask-DebugToolbar==0.9.0
Flask-SQLAlchemy==1.0
SQLAlchemy==0.8.2
Werkzeug==0.9.4
cymysql==0.6.7

The error happens even on the simplest (SQLAlchemy ORM) of queries. I added an "print(statement)" as first line in dump_query ("../panels/sqlalchemy.py", line 25), right before the "startswith" error is triggered. This is what I got, for a single get-by-id SQLAlchemy ORM query view:

b'SELECT resource.id AS resource_id, resource.type AS resource_type, resource.name AS resource_name \nFROM resource \nWHERE resource.id = %s'

The "statement" seems to be a "bytes literal" at this point in execution: "Bytes literals are always prefixed with 'b' or 'B'; they produce an instance of the bytes type instead of the str type", and apparently startswith cannot check if a "byte literal" starts with a str, hence the error. Some type cast probably would fix the issue, but I'm not sure where is the right place to do the cast.

from flask-debugtoolbar.

mgood avatar mgood commented on July 20, 2024

Please try this fix. It should handle SQL queries passed as bytes values.

from flask-debugtoolbar.

aoghina avatar aoghina commented on July 20, 2024

Works great, many thanks!

from flask-debugtoolbar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.