Integrations¶
SQLAlchemy¶
Install SQLAlchemy
pip install sqlalchemy-exasol
Connect to Exasol database using SQLAlchemy
from sqlalchemy import create_engine, text, URL
url_object = URL.create(
drivername="exa+websocket",
username="sys",
password="exasol",
host="127.0.0.1",
port="8563",
)
engine = create_engine(url_object)
# All literal text should be passed through `text()` before execution
sql_text = text("SELECT 42 FROM DUAL")
with engine.connect() as con:
result = con.execute(sql_text).fetchall()
Please also refer to the sqlalchemy-exasol documentation.
JupySQL¶
How to work with JupySQL in JupyterLab is described in Environments.
Pandas¶
Importing Data into Pandas¶
You can fetch data from Exasol into a Pandas DataFrame using pyexasol.
import pandas as pd
# Execute a query and fetch data into a Pandas DataFrame, Conn is an existing pyexasol connection.
df = conn.export_to_pandas('SELECT * FROM <your_table_name>')
# Display the DataFrame
print(df)
Exporting Data from Pandas to Exasol¶
You can also export data from a Pandas DataFrame to an Exasol table.
# Assume you have a Pandas DataFrame `df` you wish to export
conn.import_from_pandas(df, '<your_target_table_name>')
Ibis¶
Please refer to the IBIS documentation.
You can also watch this video for a step by step walk through of using Ibis with Exasol via AI Lab.