Getting Started¶
This guide is designed to get a new user started with sqlalchemy-exasol.
Prerequisites¶
Exasol >= 7.1
Python >= 3.10
Installing¶
sqlalchemy-exasol is distributed through PyPI. It can be installed via pip, poetry, or any other compatible dependency management tool:
pip install sqlalchemy-exasol
Note
SQLAlchemy will be installed as well, as it is a required dependency for SQLAlchemy-Exasol.
First Step¶
For your first step, we recommend, running this on a safe-to-test database:
examples/getting_started/0_test_first_connection.py¶
from sqlalchemy import (
URL,
create_engine,
text,
)
# These values come from the defaults of the Exasol Docker DB.
# Please adapt them for your safe-to-test DB use case.
url_object = URL.create(
drivername="exa+websocket",
username="sys",
password="exasol",
host="127.0.0.1",
port=8563,
# The value `"nocertcheck"` should only be used for non-productive use cases.
# See https://exasol.github.io/sqlalchemy-exasol/master/user_guide/configuration/security.html
# for more options for productive use cases.
query={"FINGERPRINT": "nocertcheck"},
)
# All literal text should be passed through `text()` before execution.
sql_text = text("SELECT 42 FROM DUAL")
engine = create_engine(url_object)
with engine.connect() as con:
result = con.execute(sql_text).fetchall()
print(f"QUERY RESULT: {result}")
Next Steps¶
The SQLAlchemy-Exasol documentation covers many topics at different levels of experience:
For best securing your connection, see Security.
For other connection parameters, see Connection Parameters.
Check out the available Features & related Examples, demonstrating the most important features.