Skip to main content

SQLAlchemy dialect for SQreamDB

Project description

Prerequisites

  • Python > 3.9+

  • SQLAlchemy = 2.0.27

  • SQream DB-API Connector = 3.2.5

  • Cython (optional - improves performance)

Installing SQream SQLAlchemy

pip3.9 install pysqream-sqlalchemy -U

Verifying Installation

import sqlalchemy as sa
import pandas as pd
from sqlalchemy import text


conn_str = "sqream://sqream:sqream@localhost:3108/master"
engine = sa.create_engine(conn_str, connect_args={"clustered": True})
session = orm.sessionmaker(bind=engine)()

session.execute(text('create or replace table test (ints int)'))
session.execute(text('insert into test values (5), (6)'))
df = pd.read_sql('select * from test', engine)
print(df)

Connection String

sqream://<user_login_name>:<password>@<host>:<port>/<db_name>

Parameters

Parameter

Description

username

Username of a role to use for connection

password

Specifies the password of the selected role

host

Specifies the hostname

port

Specifies the port number

port_ssl

An optional parameter

database

Specifies the database name

clustered

Establishing a multi-clustered connection. Input values: True, False. Default is False

service

Specifies service queue to use

Example

Pulling a Table into Pandas

The following example shows how to pull a table in Pandas. This example uses the URL method to create the connection string:

import sqlalchemy as sa
import pandas as pd
from sqlalchemy.engine.url import URL


     engine_url = sa.engine.url.URL(
              'sqream',
              username='sqream',
              password='12345',
              host='127.0.0.1',
              port=3108,
              database='master')
     engine = sa.create_engine(engine_url,connect_args={"clustered": True, "service": "admin"})

     table_df = pd.read_sql("select * from nba", con=engine)

Limitations

Arrays

SQream SQLAlchemy doesn’t suppport ARRAY type for columns.

Parameterized Queries

SQream SQLAlchemy supports only the BULK INSERT statement.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pysqream_sqlalchemy-1.1.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

pysqream_sqlalchemy-1.1-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file pysqream_sqlalchemy-1.1.tar.gz.

File metadata

  • Download URL: pysqream_sqlalchemy-1.1.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for pysqream_sqlalchemy-1.1.tar.gz
Algorithm Hash digest
SHA256 8ad2e3ec3b39f5241797558cd3a5af98d2ba0f79063d62e10fe54f06c02df697
MD5 7d5f91e5e0ee7fcdaca3578b09409ef1
BLAKE2b-256 bb47bdd8876bb46423c24dbbb9c7dae4421100c6f9668f8a69323f7efc933ec0

See more details on using hashes here.

File details

Details for the file pysqream_sqlalchemy-1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pysqream_sqlalchemy-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 53f0d5f90a2ddff6f9856ac55841e4323dd3436b36c8697a171795c87b5f83ab
MD5 3d267112738366d6a160f598113b8046
BLAKE2b-256 c34331f43c3ce8d8e9d2d0e84523c0d68e582ec119ef1eeaeac11819f0060557

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page