Getting Started¶
There are three ways to get started with Exasol:
Download the community edition
Use the docker version
Signup for a free SaaS trial
In the following we are going to use the SaaS version.
Setting up the db¶
Our main documentation shows you how to create a SaaS account and setup your first database and cluster.
Installing pyexasol¶
Once your database is up and running you can connect via any client. From Python we use PyExasol. It can be easily installed via
pip install pyexasol[pandas]
Connecting to the db¶
Connecting to an Exasol database is performed via:
import pyexasol
C = pyexasol.connect(dsn='<host:port>', user='sys', password='exasol')
It is slightly different when connecting to a SaaS database as we need a personal access token:
import pyexasol
C = pyexasol.connect(dsn='<host:port>', user='sys', password='<token>')
Finally you can also wrap all credentials into a local config file:
C = pyexasol.connect_local_config('my_exasol')
Executing SQL¶
Running your first query is pretty straightforward:
stmt = C.execute("SELECT * FROM EXA_ALL_USERS")
for row in stmt:
print(row)
It also allows you to load resultsets into a pandas dataframe:
C = pyexasol.connect(dsn='<host:port>', user='sys', password='exasol', compression=True)
df = C.export_to_pandas("SELECT * FROM EXA_ALL_USERS")
print(df.head())