Seeds error: unexpected column list in insert statement
See original GitHub issueI’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:
- Created 4 years ago
- Comments:9 (9 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Fixed in #36
Awesome! Thank you, @jtcohen6 !