sqlalchemy-theseus-dialect


Namesqlalchemy-theseus-dialect JSON
Version 0.0.12 PyPI version JSON
download
home_pageNone
SummaryA SQLAlchemy dialect for connecting to a Theseus Flight SQL server with ADBC
upload_time2024-07-26 15:32:52
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
keywords sqlalchemy theseus gpu flight-sql adbc dialect
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # SQLAlchemy [Theseus]((https://voltrondata.com/theseus.html)) Dialect - powered by Arrow Flight SQL ADBC 

[<img src="https://img.shields.io/badge/GitHub-prmoore77%2Fsqlalchemy--theseus--dialect-blue.svg?logo=Github">](https://github.com/prmoore77/sqlalchemy-theseus-dialect)
[![sqlalchemy-theseus-dialect-ci](https://github.com/prmoore77/sqlalchemy-theseus-dialect/actions/workflows/ci.yml/badge.svg)](https://github.com/prmoore77/sqlalchemy-theseus-dialect/actions/workflows/ci.yml)
[![Supported Python Versions](https://img.shields.io/pypi/pyversions/sqlalchemy--theseus--dialect)](https://pypi.org/project/sqlalchemy-theseus-dialect/)
[![PyPI version](https://badge.fury.io/py/sqlalchemy-theseus-dialect.svg)](https://badge.fury.io/py/sqlalchemy-theseus-dialect)
[![PyPI Downloads](https://img.shields.io/pypi/dm/sqlalchemy--flight--sql--adbc--dialect.svg)](https://pypi.org/project/sqlalchemy-theseus-dialect/)

Basic SQLAlchemy dialect for [the Theseus Data Processing Engine](https://voltrondata.com/theseus.html)

## Installation

### Option 1 - from PyPi
```sh
$ pip install sqlalchemy-theseus-dialect
```

### Option 2 - from source - for development
```shell
git clone https://github.com/prmoore77/sqlalchemy-theseus-dialect

cd sqlalchemy-theseus-dialect

# Create the virtual environment
python3 -m venv .venv

# Activate the virtual environment
. .venv/bin/activate

# Upgrade pip, setuptools, and wheel
pip install --upgrade pip setuptools wheel

# Install SQLAlchemy Theseus Dialect - in editable mode with dev dependencies
pip install --editable .[dev]
```

### Note
For the following commands - if you running from source and using `--editable` mode (for development purposes) - you will need to set the PYTHONPATH environment variable as follows:
```shell
export PYTHONPATH=$(pwd)/src
```

## Usage

Once you've installed this package, you should be able to just use it, as SQLAlchemy does a python path search

### Ensure you have access to a Theseus engine

### Connect with the SQLAlchemy Theseus Dialect
```python
import logging

from sqlalchemy import create_engine, MetaData, Table, select, Column, text, Integer, String, Sequence
from sqlalchemy.orm import Session
from sqlalchemy.engine.url import URL

# Setup logging
logging.basicConfig()
logging.getLogger('sqlalchemy.engine').setLevel(logging.INFO)


def main():
    # Build the URL
    url = URL.create(drivername="theseus",
                     host="theseus-gateway.vice.svc.cluster.local",
                     port=11234,
                     query={"disableCertificateVerification": "True",
                            "useEncryption": "False"
                            }
                     )

    print(f"Database URL: {url}")

    engine = create_engine(url=url)

    metadata = MetaData()
    metadata.reflect(bind=engine)

    for table_name in metadata.tables:
        print(f"Table name: {table_name}")

    with Session(bind=engine) as session:

        # Execute some raw SQL (this assumes you have a registered table called: "fake")
        results = session.execute(statement=text("SELECT * FROM fake")).fetchall()
        print(results)

        # Try a SQLAlchemy table select
        fake: Table = metadata.tables["fake"]
        stmt = select(fake.c.name)

        results = session.execute(statement=stmt).fetchall()
        print(results)


if __name__ == "__main__":
    main()
```

### Credits
Much code and inspiration was taken from repo: https://github.com/Mause/duckdb_engine

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "sqlalchemy-theseus-dialect",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "sqlalchemy, theseus, gpu, flight-sql, adbc, dialect",
    "author": null,
    "author_email": "Philip Moore <prmoore77@hotmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/9f/22/19b60e484a9407b0b2912fa4d1f312a3c42f3af619f76864471083639f57/sqlalchemy_theseus_dialect-0.0.12.tar.gz",
    "platform": null,
    "description": "# SQLAlchemy [Theseus]((https://voltrondata.com/theseus.html)) Dialect - powered by Arrow Flight SQL ADBC \n\n[<img src=\"https://img.shields.io/badge/GitHub-prmoore77%2Fsqlalchemy--theseus--dialect-blue.svg?logo=Github\">](https://github.com/prmoore77/sqlalchemy-theseus-dialect)\n[![sqlalchemy-theseus-dialect-ci](https://github.com/prmoore77/sqlalchemy-theseus-dialect/actions/workflows/ci.yml/badge.svg)](https://github.com/prmoore77/sqlalchemy-theseus-dialect/actions/workflows/ci.yml)\n[![Supported Python Versions](https://img.shields.io/pypi/pyversions/sqlalchemy--theseus--dialect)](https://pypi.org/project/sqlalchemy-theseus-dialect/)\n[![PyPI version](https://badge.fury.io/py/sqlalchemy-theseus-dialect.svg)](https://badge.fury.io/py/sqlalchemy-theseus-dialect)\n[![PyPI Downloads](https://img.shields.io/pypi/dm/sqlalchemy--flight--sql--adbc--dialect.svg)](https://pypi.org/project/sqlalchemy-theseus-dialect/)\n\nBasic SQLAlchemy dialect for [the Theseus Data Processing Engine](https://voltrondata.com/theseus.html)\n\n## Installation\n\n### Option 1 - from PyPi\n```sh\n$ pip install sqlalchemy-theseus-dialect\n```\n\n### Option 2 - from source - for development\n```shell\ngit clone https://github.com/prmoore77/sqlalchemy-theseus-dialect\n\ncd sqlalchemy-theseus-dialect\n\n# Create the virtual environment\npython3 -m venv .venv\n\n# Activate the virtual environment\n. .venv/bin/activate\n\n# Upgrade pip, setuptools, and wheel\npip install --upgrade pip setuptools wheel\n\n# Install SQLAlchemy Theseus Dialect - in editable mode with dev dependencies\npip install --editable .[dev]\n```\n\n### Note\nFor the following commands - if you running from source and using `--editable` mode (for development purposes) - you will need to set the PYTHONPATH environment variable as follows:\n```shell\nexport PYTHONPATH=$(pwd)/src\n```\n\n## Usage\n\nOnce you've installed this package, you should be able to just use it, as SQLAlchemy does a python path search\n\n### Ensure you have access to a Theseus engine\n\n### Connect with the SQLAlchemy Theseus Dialect\n```python\nimport logging\n\nfrom sqlalchemy import create_engine, MetaData, Table, select, Column, text, Integer, String, Sequence\nfrom sqlalchemy.orm import Session\nfrom sqlalchemy.engine.url import URL\n\n# Setup logging\nlogging.basicConfig()\nlogging.getLogger('sqlalchemy.engine').setLevel(logging.INFO)\n\n\ndef main():\n    # Build the URL\n    url = URL.create(drivername=\"theseus\",\n                     host=\"theseus-gateway.vice.svc.cluster.local\",\n                     port=11234,\n                     query={\"disableCertificateVerification\": \"True\",\n                            \"useEncryption\": \"False\"\n                            }\n                     )\n\n    print(f\"Database URL: {url}\")\n\n    engine = create_engine(url=url)\n\n    metadata = MetaData()\n    metadata.reflect(bind=engine)\n\n    for table_name in metadata.tables:\n        print(f\"Table name: {table_name}\")\n\n    with Session(bind=engine) as session:\n\n        # Execute some raw SQL (this assumes you have a registered table called: \"fake\")\n        results = session.execute(statement=text(\"SELECT * FROM fake\")).fetchall()\n        print(results)\n\n        # Try a SQLAlchemy table select\n        fake: Table = metadata.tables[\"fake\"]\n        stmt = select(fake.c.name)\n\n        results = session.execute(statement=stmt).fetchall()\n        print(results)\n\n\nif __name__ == \"__main__\":\n    main()\n```\n\n### Credits\nMuch code and inspiration was taken from repo: https://github.com/Mause/duckdb_engine\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A SQLAlchemy dialect for connecting to a Theseus Flight SQL server with ADBC",
    "version": "0.0.12",
    "project_urls": {
        "Homepage": "https://github.com/prmoore77/sqlalchemy-theseus-dialect"
    },
    "split_keywords": [
        "sqlalchemy",
        " theseus",
        " gpu",
        " flight-sql",
        " adbc",
        " dialect"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e235b5af2bab5a19dca697b3e90cf8ba3586658c37c0ace98db0b2493d6fae90",
                "md5": "f49ed977ced329da0e33f91787f62c04",
                "sha256": "11a708f46ca276d4cdf86712eeae01948f99a52c5f040866ac69ddb3a4beb17c"
            },
            "downloads": -1,
            "filename": "sqlalchemy_theseus_dialect-0.0.12-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f49ed977ced329da0e33f91787f62c04",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 9432,
            "upload_time": "2024-07-26T15:32:50",
            "upload_time_iso_8601": "2024-07-26T15:32:50.845143Z",
            "url": "https://files.pythonhosted.org/packages/e2/35/b5af2bab5a19dca697b3e90cf8ba3586658c37c0ace98db0b2493d6fae90/sqlalchemy_theseus_dialect-0.0.12-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9f2219b60e484a9407b0b2912fa4d1f312a3c42f3af619f76864471083639f57",
                "md5": "27e519a5dc1529df29af475b3bee3004",
                "sha256": "ba1434622e8ddb29ff1b1a07c8840504e65d04bbc7b9ef46442dd2503d00ae76"
            },
            "downloads": -1,
            "filename": "sqlalchemy_theseus_dialect-0.0.12.tar.gz",
            "has_sig": false,
            "md5_digest": "27e519a5dc1529df29af475b3bee3004",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 10394,
            "upload_time": "2024-07-26T15:32:52",
            "upload_time_iso_8601": "2024-07-26T15:32:52.248752Z",
            "url": "https://files.pythonhosted.org/packages/9f/22/19b60e484a9407b0b2912fa4d1f312a3c42f3af619f76864471083639f57/sqlalchemy_theseus_dialect-0.0.12.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-26 15:32:52",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "prmoore77",
    "github_project": "sqlalchemy-theseus-dialect",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "sqlalchemy-theseus-dialect"
}
        
Elapsed time: 0.28937s