Engine Configuration¶
Options for Specifying the URL¶
The value passed to create_engine() may be either an Instance of URL
or a URL string. For the url_string, the connection parameters will be
parsed, and thus, special characters must be properly escaped.
Note
For more information, like which parameters are allowed into an instance_url
and which characters need to be escaped for the url_string, see
the SQLAlchemy documentation.
Check out which parameters are suggested to include for certain scenarios in Suggested Parameters. Specific parameters for the SQLAlchemy-Exasol dialect are given in Dialect-Specific Parameters.
Instance of URL¶
from sqlalchemy import create_engine, URL
# All parameters, which are not keyword arguments for `URL.create`,
# should be specified in the `query` dictionary.
# For two specified parameters, this would follow this pattern:
# query = {"<Keyword>": "<value>", "<Keyword2>": "<value2>"}
query={
"AUTOCOMMIT": "y",
"CONNECTIONLCALL": "en_US.UTF-8"
}
url_object = URL.create(
drivername="exa+websocket",
username="sys",
password="exasol",
host="127.0.0.1",
port="8563",
query=query,
)
create_engine(url_object)
URL string¶
from sqlalchemy import create_engine
username = "sys"
password = "exasol"
host = "127.0.0.1"
port = "8563"
schema = "my_schema"
# All parameters, which are not keyword arguments for `URL.create`,
# should be specified in `query` and are of the form NAME=value
# The first parameter in the query is preceded by a `?`.
# Additional parameters are preceded by a `&`.
# For example, two parameters would follow this pattern:
# query = "?<Keyword>=<value>&<Keyword2>=<value2>"
query = "?AUTOCOMMIT=y&CONNECTIONLCALL=en_US.UTF-8"
url_string = f"exa+websocket://{username}:{password}@{host}:{port}/{schema}{query}"
create_engine(url_string)
Suggested Parameters¶
The table below suggests selected parameters for specific scenarios and gives the values as needed for the Instance of URL. One or more specified parameters may be passed to the connection URL as described in Options for Specifying the URL.
Keyword |
Description |
|---|---|
CONNECTIONLCALL |
To avoid errors due to different code pages used by the client process (Python)
and the Exasol driver, it is recommend to use |
Dialect-Specific Parameters¶
The table below lists additional parameters that are specific to the SQLAlchemy-Exasol dialect and gives the values as needed for the Instance of URL. One or more specified parameters may be passed to the connection URL as described in Options for Specifying the URL.
Keyword |
Description |
|---|---|
AUTOCOMMIT |
This indicates if the connection automatically commits or not. The parsed value is case-insensitive.
|
ENCRYPTION |
This indicates if the connection should be encrypted or not. The parsed value is case-insensitive.
For more information about TLS encryption, please see Transport Layer Security (TLS). |
FINGERPRINT |
An alternate to SSL certificate verification is to verify the connection via a fingerprint.
For more information about fingerprint verification, please see Fingerprint Verification. |
SSLCertificate |
This indicates if the connection should verify the SSL certificate or not.
For more information about verifying the SSL certificate, please see Disabling Certificate Verification. |