Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SQLite table creation sql #8430

Merged
merged 2 commits into from Mar 13, 2023
Merged

Fix SQLite table creation sql #8430

merged 2 commits into from Mar 13, 2023

Conversation

BlacAmDK
Copy link
Contributor

@BlacAmDK BlacAmDK commented Mar 13, 2023

Description

The "CREATE TABLE" statement in into sqlite does not add quotes to the column names, reproduction steps are below:

/home/xxx〉[[name,y/n];[a,y]] | into sqlite test.db
Error: 
  × Failed to prepare SQLite statement
   ╭─[entry #1:1:1]
 1 │ [[name,y/n];[a,y]] | into sqlite test.db
   ·                                                       ───┬───
   ·                                                             ╰── near "/": syntax error in CREATE TABLE IF NOT EXISTS main (name TEXT,y/n TEXT) at offset 44
   ╰────

User-Facing Changes

None

@codecov
Copy link

codecov bot commented Mar 13, 2023

Codecov Report

Merging #8430 (5cb8ab4) into main (79d0735) will increase coverage by 0.38%.
The diff coverage is 0.00%.

❗ Current head 5cb8ab4 differs from pull request most recent head 7b7e895. Consider uploading reports for the commit 7b7e895 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #8430      +/-   ##
==========================================
+ Coverage   68.12%   68.51%   +0.38%     
==========================================
  Files         620      620              
  Lines       99723    99723              
==========================================
+ Hits        67940    68328     +388     
+ Misses      31783    31395     -388     
Impacted Files Coverage Δ
...es/nu-command/src/database/commands/into_sqlite.rs 23.72% <0.00%> (ø)

... and 4 files with indirect coverage changes

@sholderbach sholderbach requested a review from rgwood March 13, 2023 10:29
@rgwood
Copy link
Contributor

rgwood commented Mar 13, 2023

Thanks for the bug fix and congrats on your first Nushell PR!

I made a small change, I think it's better to use the SQL standard " quotes instead of ` which is a MySQL thing: https://www.sqlite.org/lang_keywords.html

As an aside, I noticed that we don't have any tests for into sqlite; we should fix that someday.

@rgwood rgwood merged commit 86faf75 into nushell:main Mar 13, 2023
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants