โ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?
Passionate about hosting events and connecting people? Help us grow a vibrant local communityโsign up today to get started!
Sign Up Now