Skip to content

Problem with single-quote strings #1

@mrigger

Description

@mrigger

Thanks for the project, installing and using it worked out of the box! I noticed a minor issue when executing the code below:

from sqlvis import vis
import sqlite3

conn = sqlite3.connect(':memory:')
conn.execute('CREATE TABLE names(name TEXT)');
schema = vis.schema_from_conn(conn)
query = '''
SELECT name
FROM names
WHERE name = 'manuel'
'''
vis.visualize(query, schema)

When clicking on the name node, the string manuel is not visible and no green box is shown, which is unexpected.

Note that manuel is written in single quotes, not in double quotes. Strings in SQL are typically written using single quotes, while double quotes are reserved for identifiers (e.g., see https://stackoverflow.com/a/25141338/404483). When using double quotes like below, a green box with manuel is shown as expected:

from sqlvis import vis
import sqlite3

conn = sqlite3.connect(':memory:')
conn.execute('CREATE TABLE names(name TEXT)');
schema = vis.schema_from_conn(conn)
query = '''
SELECT name
FROM names
WHERE name = "manuel"
'''
vis.visualize(query, schema)

I'm not sure if you are actively maintaining the project and whether this issue is worth addressing, but since I just played with the project, I thought I should report it. :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions