Skip to content
This repository has been archived by the owner on May 15, 2023. It is now read-only.

Failure to connect #12

Open
alunap opened this issue Aug 4, 2022 · 0 comments
Open

Failure to connect #12

alunap opened this issue Aug 4, 2022 · 0 comments

Comments

@alunap
Copy link

alunap commented Aug 4, 2022

I have Azure databricks running in two regions (US and UK). I have been using the databricks-sql-connector successfully to connect to Hive Metastore tables in each for some months. Currently the clusters are not running all the time, but if I use the databricks connector it first spins up the appropriate cluster. I would love to be able to use SQLAlchemy instead, however.
I tried your test setup in a Jupyter notebook, but get a Operational Error.

import numpy as np
import pandas as pd
import os
from sqlalchemy import *
from sqlalchemy.engine import create_engine

def test_dialect(host, http_path, token):
engine = create_engine(
f"databricks+connector://token:{token}@{host}:443/default",
connect_args={"http_path": f"{http_path}"},
)
tables = inspect(engine).get_table_names()
print(tables)

region = "UK"
server_hostname= os.getenv(f'DATABRICKS_{region}HOSTNAME'),
http_path= os.getenv(f'DATABRICKS
{region}HTTP'),
access_token = os.getenv(f'DATABRICKS
{region}_TOKEN')
test_dialect(server_hostname, http_path, access_token)

gives:
OperationalError: (databricks.sql.exc.RequestError) Error during request to server
(Background on this error at: https://sqlalche.me/e/14/e3q8)

I do notice that this relies on PyHive, which is marked as unsupported.

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

No branches or pull requests

1 participant