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

Import SQL doesn't support comments #193

Open
alexkreidler opened this issue Apr 9, 2023 · 2 comments
Open

Import SQL doesn't support comments #193

alexkreidler opened this issue Apr 9, 2023 · 2 comments

Comments

@alexkreidler
Copy link

I have a .sql file with a table like this:

CREATE TABLE surveys (
  id int,
  title text,
  "description" text,
  created_at timestamp,
  updated_at timestamp,
  owner_id uuid,
  is_demo boolean default false,
  is_public boolean default false
  -- last_edited_by uuid,
);

When I import it into azimutt, I get this cryptic error:

Loaded simple.sql file.
Found 12 lines in the file.
Found 2 SQL statements.
Parsing error line 2:
Can't parse table: 'CREATE TABLE surveys ( id int, title text, "description" text, created_at timestamp, updated_at timestamp, owner_id uuid, is_demo boolean default false, is_public boolean default false'
Parsing error line 12:
Statement not handled: ');'
0 statements were correctly parsed, 2 were in error.

When I change it to delete the commented line, it works. It would be great to support importing files with comments!

@loicknuchel
Copy link
Contributor

Hi @alexkreidler

The SQL parser should handle comments but it seems you found an edge case that cause a bad identification of statements and thus fails :(

Thanks for your code example, it will allow me to fix :D

@asfaltboy
Copy link

I have the same issue, seems comments within table definition breaks the statement

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

No branches or pull requests

3 participants