09-11-2024 01:57 AM
Hi ,
I am getting this Error:
WHERE 1=0, Error message from Server: Configuration db table is not available. I am using PySpark and JDBC connection. Please help on this.
09-11-2024 02:22 AM
Hi @pritam_epam ,
Could you share with us more details like code that you want to execute etc.?
09-11-2024 03:03 AM
com.databricks.client.support.exceptions.GeneralException: [Databricks][JDBCDriver](500051) ERROR processing query/statement. Error Code: 0, SQL state: null, Query: SELECT * FROM (select * from scna_qa.dsml.geonode_sku_dategrp_kpi) SPARK_GEN_SUBQ_0 WHERE 1=0, Error message from Server: Configuration query is not available..
09-11-2024 03:14 AM - edited 09-11-2024 03:23 AM
Below you're passing query variable to read_sql_query function but I don't see any place in your code where you defined this.
table = (spark.read
.format("jdbc")
.option("url", "<jdbc-url>")
.option("dbtable", "<table-name>")
.option("user", "<username>")
.option("password", "<password>")
.load()
)
Query databases using JDBC - Azure Databricks | Microsoft Learn
Query databases using JDBC - Azure Databricks | Microsoft Learn
09-11-2024 03:29 AM
This is the query I already defined -
09-11-2024 03:47 AM
@szymon_dybczak I also tried the another approach you provided,
09-11-2024 04:49 AM - edited 09-11-2024 05:06 AM
Hi @pritam_epam ,
Try something similar to the following code and see if to works for you.
databricks_url = f'''jdbc:databricks://adb-774941343460743.3.azuredatabricks.net:443/default;
transportMode=http;
ssl=1;
httpPath=sql/protocolv1/o/your_org_id/your_cluster_id;
AuthMech=3;
UID=token;
PWD=your_accesss_token;
UseNativeQuery=0;
'''
df = spark.read.format("jdbc").option("url", databricks_url) \
.option("query", 'SELECT * FROM main.default.department') \
.load()
display(df)
In my case it worked without any issue:
09-11-2024 05:21 AM
No it's again throwing same type of exceptions
[Databricks][JDBCDriver](500051) ERROR processing query/statement. Error Code: 0, SQL state: null, Query: SELECT * FROM (SELECT * FROM scna_qa.dsml.geonode_sku_dategrp_kpi) SPARK_GEN_SUBQ_0 WHERE 1=0, Error message from Server: Configuration query is not available..
09-11-2024 05:24 AM
can we do a meeting to understand what's the issue?
09-12-2024 02:02 AM
Can you help us on this? Or could you provide a complete structure/steps how to connect with databricks using PySpark and JDBC step by step . Like initiate spark session then JDBC connection url then sql read all these in details.
Also what should be the JDBC version ? I am using databricks==0.2 and JDBC - DatabricksJDBC42.jar latest, what is the compatible JDBC driver?
Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.
If there isn’t a group near you, start one and help create a community that brings people together.
Request a New Group