SQLAlchemy Driver
Iomete warehouse endpoints are compatible with PyHive drivers. We need to install the following dependencies
pip install IometePyHive
pip install thrift==0.13.0
pip install sasl==0.2.1
pip install thrift-sasl==0.4.2
Code Example
For a quick start, you can use the example project template: https://github.com/iomete/iomete-pyhive-project-template
from pyhive import hive
def create_connection(account_number: str, warehouse_name: str, database: str, user_name: str, password: str):
return hive.connect(host=f"{warehouse_name}-{account_number}-dwh.iomete.com", port=443, database=database,
username=user_name, password=password, auth='CUSTOM', transport_mode='https')
if __name__ == '__main__':
# Change the following values to your values
connection = create_connection(
account_number="<account-number>",
warehouse_name="<warehouse_name>",
database="<db_name>",
user_name="<user_name>",
password="<password>")
query = "select * from <your_table> limit 20"
cursor = connection.cursor()
cursor.execute(query)
result_set = cursor.fetchall()
print(result_set)
Updated 6 months ago
Did this page help you?