Hi All,
I'm trying to write to a new Databricks table, but keep receiving the following errors:
Info: Write Data In-DB (16): ODBC Driver version: 03.80 Error: Write Data In-DB (16): Executing PreSQL: "CREATE TABLE `dbsalesretentiontest`.`tbltest` AS SELECT `FDate`, `FUserid`, `FCode`, `DSRCode`, `FSource`, `FSourceDesc`, `Do..." : [Simba][Hardy] (80) Syntax or semantic analysis error thrown in server while executing query. Error message from server: Error running query: org.apache.spark.sql.catalyst.parser.ParseException: mismatched input 'SELECT' expecting <EOF>(line 1, pos 102) == SQL == CREATE TABLE `dbsalesretentiontest`.`tbltest` AS SELECT C_18, C_16, C_14, C_21, C_43, C_6, C_17 FROM SELECT C_646273616c6573726574656e74696f6e5f6461696c7973616c65735f74626c5f6d6173757373616c6573.`FDate` AS C_18, C_646273616c6573726574656e74696f6e5f6461696c7973616c65735f74626c5f6d6173757373616c6573.`FUserid` AS C_16, C_646273616c6573726574656e74696f6e5f6461696c7973616c65735f74626c5f6d6173757373616c6573.`FCode` AS C_14, C_646273616c6573726574656e74696f6e5f6461696c7973616c65735f74626c5f6d6173757373616c6573.`DSRCode` AS C_21, C_646273616c6573726574656e74696f6e5f6461696c7973616c65735f74626c5f6d6173757373616c6573.`FSource` AS C_43, C_646273616c6573726574656e74696f6e5f6461696c7973616c65735f74626c5f6d6173757373616c6573.`FSourceDesc` AS C_6, C_646273616c Error: Write Data In-DB (16): Error running PreSQL on "NoTable": [Simba][Hardy] (80) Syntax or semantic analysis error thrown in server while executing query. Error message from server: Error running query: org.apache.spark.sql.catalyst.parser.ParseException: mismatched input 'SELECT' expecting <EOF>(line 1, pos 102) == SQL == CREATE TABLE `dbsalesretentiontest`.`tbltest` AS SELECT C_18, C_16, C_14, C_21, C_43, C_6, C_17 FROM SELECT C_646273616c6573726574656e74696f6e5f6461696c7973616c65735f74626c5f6d6173757373616c6573.`FDate` AS C_18, C_646273616c6573726574656e74696f6e5f6461696c7973616c65735f74626c5f6d6173757373616c6573.`FUserid` AS C_16, C_646273616c6573726574656e74696f6e5f6461696c7973616c65735f74626c5f6d6173757373616c6573.`FCode` AS C_14, C_646273616c6573726574656e74696f6e5f6461696c7973616c65735f74626c5f6d6173757373616c6573.`DSRCode` AS C_21, C_646273616c6573726574656e74696f6e5f6461696c7973616c65735f74626c5f6d6173757373616c6573.`FSource` AS C_43, C_646273616c6573726574656e74696f6e5f6461696c7973616c65735f74626c5f6d6173757373616c6573.`FSourceDesc` AS C_6, C_646273616c
I've tried to remove any special characters (underscores etc.) from table and field names. Could there be any other issues?
I can also see the results of the query in Browse with no issues.
@rasmith88 remove any special characters and organise your nested queries with matching brackets. Check that there are no spaces with the "." when you refer to <table name>.<column name> etc.
Can you test the SQL syntax beforehand?
Hi @RishiK
I've just found I can write if I go from 'Connect In_DB' to 'Write Data In-DB' directly, but the SQL error seems to have creeped in when I added a 'Select In-DB' step to only select a few fields.
Would it just be advisable to adjust the original 'Connect In_DB' to select the required fields?