**********************************
SQLAlchemy Dialect for SQream DB
**********************************
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
=============================
.. code-block:: shell
pip3.9 install pysqream-sqlalchemy -U
Verifying Installation
------------------------
.. code-block:: python
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
=====================
.. code-block:: shell
sqream://<user_login_name>:<password>@<host>:<port>/<db_name>
Parameters
------------
.. list-table::
:widths: auto
:header-rows: 1
* - 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:
.. code-block:: python
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.
Raw data
{
"_id": null,
"home_page": "https://github.com/SQream/pysqream_sqlalchemy",
"name": "pysqream-sqlalchemy",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "database sqlalchemy sqream sqreamdb",
"author": "SQream",
"author_email": "info@sqream.com",
"download_url": "https://files.pythonhosted.org/packages/74/b6/8a9fded2a07e1905632ef3999f3abbfa268120962745575327e5634b14bb/pysqream_sqlalchemy-1.3.tar.gz",
"platform": null,
"description": "**********************************\nSQLAlchemy Dialect for SQream DB\n**********************************\n\nPrerequisites\n================\n\n* SQream => 4.5.6\n* Python == 3.9\n* SQLAlchemy == 2.0.27\n* SQream DB-API Connector == 3.2.5\n* Cython (optional - improves performance)\n\nInstalling SQream SQLAlchemy\n=============================\n\n.. code-block:: shell\n\n pip3.9 install pysqream-sqlalchemy -U\n\nVerifying Installation\n------------------------\n\n.. code-block:: python\n\n import sqlalchemy as sa\n import pandas as pd\n from sqlalchemy import text\n\n\n conn_str = \"sqream://sqream:sqream@localhost:3108/master\" \n engine = sa.create_engine(conn_str, connect_args={\"clustered\": True})\n session = orm.sessionmaker(bind=engine)()\n\n session.execute(text('create or replace table test (ints int)'))\n session.execute(text('insert into test values (5), (6)'))\n df = pd.read_sql('select * from test', engine)\n print(df)\n\nConnection String \n=====================\n\n.. code-block:: shell\n\n sqream://<user_login_name>:<password>@<host>:<port>/<db_name>\n\nParameters\n------------\n\n.. list-table:: \n :widths: auto\n :header-rows: 1\n \n * - Parameter\n - Description\n * - ``username``\n - Username of a role to use for connection\n * - ``password``\n - Specifies the password of the selected role\n * - ``host``\n - Specifies the hostname\n * - ``port``\n - Specifies the port number\n * - ``port_ssl``\n - An optional parameter\n * - ``database``\n - Specifies the database name \n * - ``clustered``\n - Establishing a multi-clustered connection. Input values: ``True``, ``False``. Default is ``False``\n * - ``service``\n - Specifies service queue to use\n\nExample\n=========\n\nPulling a Table into Pandas\n---------------------------\n\nThe following example shows how to pull a table in Pandas. This example uses the URL method to create the connection string:\n\n.. code-block:: python\n\n import sqlalchemy as sa\n import pandas as pd\n from sqlalchemy.engine.url import URL\n\n\n\tengine_url = sa.engine.url.URL(\n 'sqream',\n username='sqream',\n password='12345',\n host='127.0.0.1',\n port=3108,\n database='master')\n\tengine = sa.create_engine(engine_url,connect_args={\"clustered\": True, \"service\": \"admin\"})\n\n\ttable_df = pd.read_sql(\"select * from nba\", con=engine)\n\n\nLimitations\n=============\n\nArrays\n-----------------------\nSQream SQLAlchemy doesn't suppport ``ARRAY`` type for columns.\n\n\nParameterized Queries\n-----------------------\nSQream SQLAlchemy supports only the ``BULK INSERT`` statement.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
"bugtrack_url": null,
"license": null,
"summary": "SQLAlchemy dialect for SQreamDB",
"version": "1.3",
"project_urls": {
"Homepage": "https://github.com/SQream/pysqream_sqlalchemy"
},
"split_keywords": [
"database",
"sqlalchemy",
"sqream",
"sqreamdb"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "50b0b2c4b94f3fcbe070e0ff7a1e00245d27ea058a6f6cf6e1265e89637ee511",
"md5": "10d79b73f8c88fb1d39f4fce1c59553d",
"sha256": "225627477c4d2df7d1434c87b931c28460107c2dbf9bb78c6712ebc89484cb52"
},
"downloads": -1,
"filename": "pysqream_sqlalchemy-1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "10d79b73f8c88fb1d39f4fce1c59553d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 10672,
"upload_time": "2024-08-12T09:10:46",
"upload_time_iso_8601": "2024-08-12T09:10:46.530891Z",
"url": "https://files.pythonhosted.org/packages/50/b0/b2c4b94f3fcbe070e0ff7a1e00245d27ea058a6f6cf6e1265e89637ee511/pysqream_sqlalchemy-1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "74b68a9fded2a07e1905632ef3999f3abbfa268120962745575327e5634b14bb",
"md5": "3c3d40cb0e4b078aca5a34d0245523b8",
"sha256": "5e1bd9831caf8d77439fcba4a9d473d3caef07be1a69524ed10b5962ef74e042"
},
"downloads": -1,
"filename": "pysqream_sqlalchemy-1.3.tar.gz",
"has_sig": false,
"md5_digest": "3c3d40cb0e4b078aca5a34d0245523b8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 11050,
"upload_time": "2024-08-12T09:10:48",
"upload_time_iso_8601": "2024-08-12T09:10:48.208871Z",
"url": "https://files.pythonhosted.org/packages/74/b6/8a9fded2a07e1905632ef3999f3abbfa268120962745575327e5634b14bb/pysqream_sqlalchemy-1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-12 09:10:48",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "SQream",
"github_project": "pysqream_sqlalchemy",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "alembic",
"specs": [
[
"==",
"1.10.2"
]
]
},
{
"name": "numpy",
"specs": [
[
"==",
"1.26.4"
]
]
},
{
"name": "SQLAlchemy",
"specs": [
[
"==",
"2.0.27"
]
]
},
{
"name": "pandas",
"specs": [
[
"==",
"2.2.2"
]
]
},
{
"name": "pysqream",
"specs": [
[
">=",
"5.1.0"
]
]
},
{
"name": "setuptools",
"specs": [
[
">=",
"57.4.0"
]
]
},
{
"name": "pytest",
"specs": [
[
"==",
"7.4.2"
]
]
}
],
"lcname": "pysqream-sqlalchemy"
}