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.

csvsql: "no such table" error only thrown when force-quitting

See original GitHub issue

I am querying a data file:

csvsql --query 'select max(video_session_started_at) from data' tmp_correct_ids.csv

I did this, naively, by adapting the existing code, assuming that data would be a generic name for the table that’d be generated in memory after reading from the CSV.

I was wrong. It seems the table name is inferred from the CSV filename without suffix. I later learned that from carefully reading the manpage.

However, earlier, I only found out after I killed the command:

^C(sqlite3.OperationalError) no such table: data
[SQL: select max(video_session_started_at) from data]
(Background on this error at: http://sqlalche.me/e/e3q8)

Would it be possible to throw this error and stop csvsql once it occurs? The command just seemed to hang for me until I quit it.

Using csvsql 1.0.4 under Ubuntu 18.04 with Python 3.6.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dannyseplercommented, Apr 6, 2020

just an update here, i’m going to bow out of this one. Sorry! It doesn’t seem like a bug so much as a speedup feature. While that would still be fun, the only ways I can rationalize doing it are pretty messy. (Like you said, the table name inference is easy. But how do we know what tables are being are being queried for? Seems like we’ll need a SQL parser of some sort.)

To me an interesting question as well is around what happens when you Ctrl-C a big table read, and it gets caught in the “StopIteration” here. Somehow, it is still able to successfully continue the command!

Just leaving some food for thought for whoever picks this up next.

0reactions
jpmckinneycommented, Apr 2, 2020

Thanks in advance, @dannysepler!

Read more comments on GitHub >

github_iconTop Results From Across the Web

OperationalError: no such table: entries - Stack Overflow
I found the problem. I need to create the tables first before the execution of code. So I just opened the python shell...
Read more >
csvsql — csvkit 1.0.2 documentation - Read the Docs
Generate SQL statements for a CSV file or execute those statements directly on a database. In the latter case supports both creating tables...
Read more >
supports opening documents in place - OSCHINA - 中文开源技术 ...
The only officially supported distributions are TeX Live, and MiKTeX. ... 2.9\miktex\bin If your TeX distribution's binaries are not installed in one of ......
Read more >
'No such table' returned while the database contains it - SQLite
It seems the connection refers to an empty database, but I can see content when browsing the database after the application crashed. I...
Read more >
EasyBuild Documentation - Read the Docs
Note that easyconfig files only provide the bits of information required to determine ... If no such easyconfig file was specified on the...
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