Appending a local Pandas dataframe to a Delta table in Azure is slow
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- azure, pandas, python, sqlalchemy
- Ambito
- databases, performance
Direzione di ricerca
Non sono indicati file del repository né test. Inizia riproducendo l'esempio fornito di pandas DataFrame.to_sql con databricks-sql-connector 3.4.0 sul SQL warehouse indicato, quindi segui il percorso di scrittura di SQLAlchemy e connector per individuare il ritardo per riga. Il lavoro è completato quando viene identificato un percorso di scrittura più veloce supportato oppure vengono documentati il limite e la sua causa.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I followed the instructions on this page to create a SQLAlchemy engine and used it with the Pandas to_sql() method. It's taking around 2 seconds to append one data point to a Delta table in Azure Databricks, and it seems to be scaling linearly. A dataframe containing 1 column and 10 rows is taking ~20 seconds to push to Azure.
Is there a way to make writing back to Databricks from a local machine faster?
Example code:
from sqlalchemy import create_engine
import pandas as pd
import os
server = 'my_server.azuredatabricks.net'
http_path = "/sql/1.0/warehouses/my_warehouse"
access_token = "MY_TOKEN"
catalog = "my_catalog"
schema = "my_schema"
if "NO_PROXY" in os.environ:
os.environ["NO_PROXY"] = os.environ["NO_PROXY"] + "," + server
else:
os.environ["NO_PROXY"] = server
if "no_proxy" in os.environ:
os.environ["no_proxy"] = os.environ["no_proxy"] + "," + server
else:
os.environ["no_proxy"] = server
engine = create_engine(f"databricks://token:{access_token}@{server}?" +
f"http_path={http_path}&catalog={catalog}&schema={schema}"
)
df = pd.DataFrame({'name' : ['User 1', 'User 2', 'User 3', User 4', 'User 5', 'User 6', User 7', 'User 8', 'User 9', 'User 10']})
# The next command takes around 20 seconds to complete
df.to_sql(name='my_test_table', con=engine, if_exists='append', index=False)
Local specs:
databricks-sql-connector==3.4.0
pandas==2.2.2
Python 3.10.14
Azure specs:
Databricks SQL warehouse cluster
Runtime==13.3 LTS
- Lingua principale
- Python
- Stelle
- 233
- Fork
- 152
- Merge medio
- 21h 5m
- PR unite (30g)
- 10
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di databricks/databricks-sql-python
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
Tutte le issue di databricks/databricks-sql-python
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
anthropics/skills#1811 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
speaches-ai/speaches#678 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
datalayer/mcp-compose#42 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
conda-forge/spacy-feedstock#177 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
UKGovernmentBEIS/inspect_evals#2523 ·