Prerequisites
SQream => 4.5.6
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.
Metadata
Release files for pysqream-sqlalchemy 1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pysqream_sqlalchemy-1.3.tar.gz | 11.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pysqream_sqlalchemy-1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.7 kB
Release files / pysqream_sqlalchemy-1.3.tar.gz
| Download URL | pysqream_sqlalchemy-1.3.tar.gz |
|---|---|
| Size | 11.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5e1bd9831caf8d77439fcba4a9d473d3caef07be1a69524ed10b5962ef74e042
|
|
BLAKE2b-256 checksum How to use checksums |
74b68a9fded2a07e1905632ef3999f3abbfa268120962745575327e5634b14bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.0 CPython/3.12.5
|
Release files / pysqream_sqlalchemy-1.3-py3-none-any.whl
| Download URL | pysqream_sqlalchemy-1.3-py3-none-any.whl |
|---|---|
| Size | 10.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
225627477c4d2df7d1434c87b931c28460107c2dbf9bb78c6712ebc89484cb52
|
|
BLAKE2b-256 checksum How to use checksums |
50b0b2c4b94f3fcbe070e0ff7a1e00245d27ea058a6f6cf6e1265e89637ee511
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.0 CPython/3.12.5
|