Sal
Peter Hoffmann Director Data Engineering at Blue Yonder. Python Developer, Conference Speaker, Mountaineer

python sqlalchemy exasol 0.9.1 with distribute by support

sqlalchemy exasol 0.9.1 has been released. This release adds support for data distribution on the nodes of the cluster with the distribute by statement.

from sqlalchemy import create_engine, MetaData, Table, Column, Integer
from sqlalchemy_exasol.constraints import DistributeByConstraint
from sqlalchemy.schema import CreateTable

engine = create_engine("exa+pyodbc://user:pw@host/")

md = MetaData(bind=engine)

t = Table('t', md,
           Column('a', Integer),
           Column('b', Integer),
           Column('c', Integer),
           DistributeByConstraint('a', 'b')
        )

print CreateTable(t).compile(engine)

which results in the following create table statement

CREATE TABLE t (
    a INTEGER,
    b INTEGER,
    c INTEGER,
    DISTRIBUTE BY a,b
)