Skip to content

Instantly share code, notes, and snippets.

@stevehenderson
Created July 29, 2022 12:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevehenderson/4a03cedde6d0db228e6c3168ab028283 to your computer and use it in GitHub Desktop.
Save stevehenderson/4a03cedde6d0db228e6c3168ab028283 to your computer and use it in GitHub Desktop.
Collab and Presto
# 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