question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot parse sqlite `NVARCHAR` correctly

See original GitHub issue

SQLite uses NVARCHAR() for VARCHAR() but it appears sqlglot does not support this.

sqlglot.errors.ParseError: Expecting ). Line 1, Col: 19.
  CREATE TABLE z (a NVARCHAR(200) NOT NULL)

I think the correct thing is to map NVARCHAR to VARCHAR in the sqlite dialect definition’s keywords block, and that works the case above, but this case still fails:

sqlglot.errors.ParseError: Expecting ). Line 5, Col: 12.

CREATE TABLE "Track"
(
    "TrackId" INTEGER  NOT NULL,
    "Name" NVARCHAR(200)  NOT NULL,
    "AlbumId" INTEGER,
    "MediaTypeId" INTEGER  NOT NULL,
    "GenreId" INTEGER,

Not sure why the latter case isn’t fixed by adding the NVARCHAR mapping to the VARCHAR token type.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
tobymaocommented, Aug 8, 2022

i’ve added constraint and foreign key parsing

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sqlite3 cannot correctly query a UTF-8 string? - Stack Overflow
To fix it, I had to convert all my input data to the decomposed form. from unicodedata import normalize with open(poll, encoding='utf-8') as ......
Read more >
Frequently Asked Questions - SQLite
Short answer: A column declared INTEGER PRIMARY KEY will autoincrement. Longer answer: If you declare a column of a table to be INTEGER ......
Read more >
SQLite can't open database file - error: encrypted or not a ...
I was able to copy the database file into the application's local folder. However, I can't open it. When I run this code,...
Read more >
How to properly format sqlite shell output?
For "human readable" output, you can use column mode, and turn header output on. That will get you something similar to the sqlplus...
Read more >
How to config Identity for SQLite · Issue #5131 - GitHub
I'm going in circles following the links and not finding a good summary. All I read is "I spent a lot of time...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found