Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【feat】 hive/kyuubi and presto/trino jdbc support #364

Open
zyclove opened this issue Apr 16, 2024 · 2 comments
Open

【feat】 hive/kyuubi and presto/trino jdbc support #364

zyclove opened this issue Apr 16, 2024 · 2 comments

Comments

@zyclove
Copy link
Contributor

zyclove commented Apr 16, 2024

Is your feature request related to a problem? Please describe.

Visual display and analysis of data in big data scenarios requires support for automatic SQL generation.

Describe the solution you'd like

Support hive/spark-sql and trino/presto SQL automatic generation

Describe alternatives you've considered
Read hive-metastore metadata collection, automatically generate SQL according to the supported engine (hive/spark/kyuubi/presto/trino) and data table structure, and display the data visually

@zainhoda
Copy link
Contributor

This should already be possible if you select "Other Database" in the documentation:
https://vanna.ai/docs/other-database-openai-vanna-vannadb/

Basically Vanna just needs you to provide a method called run_sql that takes in a SQL statement as a string and returns a pandas dataframe. As long as you provide Vanna that function, everything else should work similarly.

@zyclove
Copy link
Contributor Author

zyclove commented Apr 18, 2024

@zainhoda

Can the JayDeBeApi framework be introduced to support connecting to the database through jdbc jar? It is also very convenient to use, more versatile and flexible.

import jaydebeapi

# Set JDBC driver path and connection URL
driver = "org.apache.kyuubi.jdbc.KyuubiHiveDriver"
url = "jdbc:kyuubi://host:port/default"
jdbc_driver_path = ["/path/to/kyuubi-hive-jdbc-*.jar"]

# Connect to the database using JayDeBeApi
conn = jaydebeapi.connect(driver, url, ["user", "password"], jdbc_driver_path)

# Create a cursor object
cursor = conn.cursor()

# Execute the SQL query
cursor.execute("SELECT * FROM example_table LIMIT 10")

# Retrieve query results
result_set = cursor.fetchall()

# Process the results
for row in result_set:
    print(row)

# Close the cursor and the connection
cursor.close()
conn.close()
image

https://kyuubi.readthedocs.io/en/v1.9.0/client/python/jaydebeapi.html
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants