0

Using Spark 2.4.0 and Exasol 6.2.0, I want to create a DataFrame over jdbc from a simple query SELECT * FROM table_name over JDBC.

This is the code in scala:

      df = sparkSession.read
        .format("jdbc")
        .option("driver", sourceJDBCConn("jdbcDriver"))
        .option("url", sourceJDBCConn("jdbcUrl"))
        .option("user", sourceJDBCConn("jdbcUsername"))
        .option("password", sourceJDBCConn("jdbcPassword"))
        .option("query", "SELECT * FROM table_name")
        .load()

This works with PostgreSQL but not with Exasol. If I look into the session-audit I find the following SQL:

SELECT * FROM (SELECT * FROM table_name) __SPARK_GEN_JDBC_SUBQUERY_NAME_0 WHERE 1=0

the error message from Exasol is the folowing:

syntax error, unexpected $undefined, expecting UNION_ or EXCEPT_ or MINUS_ or INTERSECT_ [line 1, column 98]

While PostgreSQL looks to accept the alias with the 2 leading underscores, such an alias is not allowed in Exasol. Is there any workaround to change the name of the alias __SPARK_GEN_JDBC_SUBQUERY_NAME_0 with an identifier accepted by Exasol?

0 Answers0