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.

Seeds error: unexpected column list in insert statement

See original GitHub issue

I’m getting the error below when attempting to load a seeds file. (I’m new so this is my first time trying.)

Runtime Error in seed test_seed (data/test_seed.csv)
  Database Error
    org.apache.spark.sql.catalyst.parser.ParseException:
    mismatched input 'my_col_a' expecting {'(', 'SELECT', 'FROM', 'VALUES', 'TABLE', 'INSERT', 'MAP', 'REDUCE'}(line 2, pos 43)

    == SQL ==

                insert into default.test_seed (my_col_a,  my_col_b) values
    -------------------------------------------^^^
                ('hi',' "Hi"'),('bye',' "Bye"')

On comparing this with the online docs checking the documentation, it looks like the column list is disallowed.

The query dtb-spark is trying to run is:

insert into default.test_seed (my_col_a,  my_col_b) values ('hi',' "Hi"'),('bye',' "Bye"')

And the corrected query would be:

insert into default.test_seed values ('hi',' "Hi"'),('bye',' "Bye"')

(Confirmed above via testing in Spark 2.4)

Or to retain the self-documenting aspect (given that columns apparently can’t be declared):

insert into default.test_seed /*(my_col_a,  my_col_b)*/ values ('hi',' "Hi"'),('bye',' "Bye"')

Happy to send a PR if you know where in the code I should start. I’m new to DBT but happy to contribute if I can.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
jtcohen6commented, Feb 7, 2020

Fixed in #36

0reactions
aaronsteerscommented, Feb 7, 2020

Awesome! Thank you, @jtcohen6 !

Read more comments on GitHub >

github_iconTop Results From Across the Web

Seeds error: unexpected column list in insert statement #32
(I'm new so this is my first time trying.) Runtime Error in seed test_seed (data/test_seed.csv) Database Error org.apache.spark.sql.catalyst.
Read more >
INSERT statement conflicted with the FOREIGN KEY constraint
In your table dbo.Sup_Item_Cat , it has a foreign key reference to another table. The way a FK works is it cannot have...
Read more >
Database Engine events and errors - SQL Server
Consult this MSSQL error code list to find explanations for error messages for SQL Server database engine events.
Read more >
INSERT Operations That Are Not Valid - Teradata Database
INSERT Operations That Are Not Valid An INSERT operation causes an error or failure message to be returned if any of the following...
Read more >
Working with SQL Server identity columns - Simple Talk
The error message clearly states that you cannot explicitly insert an identify value unless you specify a column list along with the INSERT...
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