Facing a 'syntax error' upon trying to write a data into the table using Spark

LordBertson
Contributor

Hi all, I am facing this issue attempting to write a DataFrame to a table using Exasol JDBC.

Upon the following statement,

test_table.write.format('jdbc').options(
    url='jdbc:exa:'+exasol_adress, 
    driver='com.exasol.jdbc.EXADriver', 
    dbtable='TEST.CSV_TABLE', 
    user='sys', 
    password='exasol', 
    create_table='true').mode('append').save()

following error is thrown:

java.sql.SQLSyntaxErrorException: syntax error, unexpected IDENTIFIER_LIST_, expecting ',' or ')'

It seems to me, as if this was translated into SQL incorrectly by a driver resulting in a syntax error.

As for the setup that might be relevant, I am using Exasol JDBC driver 7.0.4, with Spark 3.0.1.

Please advise.

1 ACCEPTED SOLUTION

exa-Nico
Community Manager
Community Manager

What happens if you create the table in advance (using varchars) and then set create_table='false'?

Sports Enthusiast. Database Guy. Member of Team Exasol.
Having trouble? Just let me know!

Please Give Kudos if you find this post useful and also mark this as Accepted Solution if this is the required solution

View solution in original post

5 REPLIES 5

exa-Chris
Community Manager
Community Manager

Hi @LordBertson ,
I will nudge some people to get an answer for you.
Rgds
@exa-Chris 

Connecting Customers, Partners, Prospects and Exasolians is my passion. Apart from that I cycle, listen to music, and try to understand what all those technical discussions really mean...

LordBertson
Contributor

Hi @exa-Chris 

thanks. I am doing some tinkering of my own and I am starting to suspect it's caused by some unescaped quotes that eat up a comma somewhere.

If I arrive at some results I'll post it here.

Best Regards
Peter

LordBertson
Contributor

Okay, it's weirder than that, it attempts to execute a following query to 

CREATE TABLE TESTS.CSV_TABLE ("ID" TEXT , 
                               "NAME" TEXT , 
                               "LASTNAME" TEXT )

Where Exasol does not know the type TEXT

exa-Nico
Community Manager
Community Manager

What happens if you create the table in advance (using varchars) and then set create_table='false'?

Sports Enthusiast. Database Guy. Member of Team Exasol.
Having trouble? Just let me know!

Please Give Kudos if you find this post useful and also mark this as Accepted Solution if this is the required solution

View solution in original post

LordBertson
Contributor

Sorry for late response, it's just what I did and then it worked like a charm.