Created
July 29, 2022 12:14
-
-
Save stevehenderson/4a03cedde6d0db228e6c3168ab028283 to your computer and use it in GitHub Desktop.
Collab and Presto
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First run this in top cell: pip install pyhive | |
from pandas import read_sql | |
from pyhive import presto | |
presto_conn = presto.Connection(host="collab-cluster-hostname-m", schema="your_presto_schema", catalog="presto_catalog", port=8060, username ="presto") | |
presto_cursor = presto_conn.cursor() | |
# Query presto node | |
query = "select * FROM system.runtime.nodes" | |
query_result = read_sql(query, presto_conn) | |
query_result) | |
# Query a table in the catalog | |
query = "select count(*) from mytable" | |
query_result = read_sql(query, presto_conn) | |
query_result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment