Skip to content

Fix SQLite table creation sql#8430

Merged
rgwood merged 2 commits intonushell:mainfrom
BlacAmDK:BlacAmDK-patch-1
Mar 13, 2023
Merged

Fix SQLite table creation sql#8430
rgwood merged 2 commits intonushell:mainfrom
BlacAmDK:BlacAmDK-patch-1

Conversation

@BlacAmDK
Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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
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.

2 participants