Database Error: 001003 (42000): SQL compilation error - dbt

I am getting this error when using dbt cli 0.21.1 with Snowflake:
Encountered an error: Database Error 001003 (42000): SQL compilation error: syntax error line 1 at position 31 unexpected '<EOF>'. syntax error line 1 at position 30 unexpected '.'.
... when running "dbt build". I have stripped down my models to the minimum and get the same error whatever I do. I have done "dbt clean". The results of "dbt debug" and "dbt parse" look fine.
In the dbt.log file, I can see it fails on a Snowflake command:
create schema if not exists FT.
... with the SQL compilation error message shown above.
I found the same error in the Snowflake query history, with the same command text. So I tried it by hand in the Snowflake console. Lo and behold, it works fine without the trailing period, but Snowflake produces exactly this error with that trailing period.
So it seems like dbt and Snowflake disagree about whether a SQL command should end with a period. Which one has a bug? Or is there a way to tell one or the other to change?

I forgot that I had created a generate_schema_name macro -- and it was messing up the schema name, turning it into an empty string. The create schema command was trying to create a schema named "FT." but because the schema name was blank, it ended up as "FT." -- and the trailing period confused me.
Mea culpa.
Hope this description ends up helping someone else who makes the same mistake.

Related

DataGrip only executing first 19 lines of SQL query

I'm attempting to execute a 236 line query in DataGrip in an attached BigQuery console. When I select the whole script to run, it always only executes up to the 19th line. Because of that, I get this error
[HY000][100032] [Simba][BigQueryJDBCDriver](100032) Error executing query job. Message: Syntax error: Unexpected end of script at [19:49] com.simba.googlebigquery.support.exceptions.GeneralException: [Simba][BigQueryJDBCDriver](100032) Error executing query job. Message: Syntax error: Unexpected end of script at [19:49]
I've tried running it as a SQL file as well, but that resulted in the same error. I Know that this query is valid because it returns the desired results when I run it directly in the Google Cloud query editor. Has anyone else run into this issue, and is there a fix?
We introduced BigQuery dialect recently and it does not apply to your previously created data source after update, since this data source was created with custom driver with 'Generic' dialect as default. It is needed to change dialect in driver options, then you'll have all related consoles and datasources with correct one.

Symfony 4 - SQLSTATE[42000] alter table for unknown reasons

I'm here because, I need your help. I'm working on a Symfony project, I just finished to modify my DataBase with MySqlWorkBench (I've done this because I have to present the DataBase at the end of the school year). After that, I've executed "Forward Engineer" to send all the tables and columns to the database.
Then, i've just entered this line, to create my entities:
php bin/console doctrine:mapping:import "App\Entity" annotation --path=src/Entity
Later I put this line line to generate my setters/getters and my Repositories
php bin/console make:entity --regenerate App
When it's done, I've used those lines :
php bin/console d:m:diff
And I migrate all to the database:
php bin/console d:migrations:execute --up 20190321194410
And after this command, I got a ton of errors but they deal of the same thing.
There is this query, I don't know why it's executed:
ALTER TABLE school_has_level RENAME INDEX fk_school_has_school_level_school1_idx TO IDX_102C1F10C32A47EE
And after there is those errors :
In AbstractMySQLDriver.php line 79:
An exception occurred while executing 'ALTER TABLE school_has_level RENAME INDEX fk_school_has_school_level_school1_idx TO IDX_102C1F10C32A47EE':
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB serve
r version for the right syntax to use near 'INDEX fk_school_has_school_level_school1_idx TO IDX_102C1F10C32A47EE' at line 1
I'm searching some tips on Internet but I didn't find anything about that. The problem is that, I don't understand where the query is started...
Thank you for your future answer, and sorry for my english :'(
Best regards,
Mathieu

Importing database in PostgreSQL using pg_dump having ERROR: 42601: syntax error at or near "psql"

i am using PostgreSQL database for my application. Now i have to import my all databases in it.
I am using this command for importing,
psql -U postgres Employees < dbimport.pgsql
but it is not importing. I have already created the database with name Employees in my PostgreSQL.
Getting Error like,
42601: syntax error at or near "psql"
Please suggest me if i am going wrong.
if you have postgres client installed, probably you have misconfigured environmental variables ($PATH), to find the psql use instructions here: https://stackoverflow.com/a/44106963/5315974
Basically you need to usemlocate (if you have it installed) or just find...
Unrelated, but also I would avoid using mixed case in database name...
Also 42601: syntax error at or near "psql" error code means you try to run psql as SQL statement, which it is not - look into your dbimport.pgsql if you have not SQL there - maybe it is shell (or some other) script?..
The error 42601: syntax error at or near "psql" is a syntax_error from the database not from the terminal, so the value of $PATH is not wrong.
It looks like the file 'dbimport.pgsql' which you are trying to import does not contain the importable data.
Can you confirm, how this backup was taken? Or the content of file 'dbimport.pgsql'.

Firebird select statement gives SQLSTATE = 42S02

I've made a very simple database and am trying
select * from klant;
I've verified the table exists, and last week was able to see data in it. Today however I keep getting
Statement failed, SQLSTATE = 42S02
Dynamic SQL Error
-SQL error code = -204
-Table unknown
-KLANT
-At line 1, column 15
The same select query in flameRobin gives the following error:
Error: *** IBPP::SQLException ***
Context: Database::Statistics
Message: isc_database_info failed
SQL Message : -902
can't format message 13:98 -- message file C:\WINDOWS\SYSTEM32\firebird.msg not found
Engine Code : 335544727
Engine Message :
Error writing data to the connection.
I have copied the firebird.msg to the system32 folder so it should be able to find it there.
Any pointers toward the solution would be greatly appreciated. Similar question all seem to point toward issues with transactions, I can't see that being the problem here.
Edit:
I'm using the included ISQL tool from firebird and start the session by connecting to the database that includes my table. Same for flamerobin, first connect to database, I can see the table that i want to select from but it gives this error.
Edit2:
Finally reinstalled Firebird making sure I gave it admin right, which I think it had before, but wasn't sure about. This seems to have fixed it.

Syntax error: Encountered "<EOF>" in derby on DROP SEQUENCE statement

Some sequences were created because of the error described here. To keep everything clean I tried to delete them with the command DROP SEQUENCE seqname;. It produces me the following message:
Error code -1, SQL state 42X01: Syntax error: Encountered "" at line 1, column 20.
Line 1, column 1
Execution finished after 0 s, 1 error(s) occurred.
I guess it is because I work on Windows machine which has different EOF marker. But how to solve the problem in SQL?
After several trials the solution is DROP SEQUENCE sequence_name RESTRICT which was found here. Adding RESTRICT to the SQL statement solves the problem