Skip to main content

py-data-api is a user-friendly client for AWS Aurora Serverless's Data API

Project description

py-data-api - Data API Client for Python

Test Status PyPI version PyPI - Python Version codecov license Code style: black

py-data-api is a client for Data API of Aurora Serverless. Also, the package includes SQLAlchemy Dialects and DB API 2.0 Client.

Features

  • SQLAlchemy Dialects
  • DB API 2.0 compatible client PEP 249

Support Database Engines

  • MySQL
  • PostgreSQL

What's AWS Aurora Serverless's Data API?

https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/data-api.html

This project is an experimental phase.

Warning: Some interface will be changed.

How to install

pydataapi requires Python 3.6.1 or later

$ pip install pydataapi

Example

from typing import List

from sqlalchemy import Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base

from pydataapi import DataAPI, Result


class Pets(declarative_base()):
    __tablename__ = 'pets'
    id = Column(Integer, primary_key=True, autoincrement=True)
    name = Column(String(255, collation='utf8_unicode_ci'), default=None)


database: str = 'test'
resource_arn: str = 'arn:aws:rds:us-east-1:123456789012:cluster:serverless-test-1'
secret_arn: str = 'arn:aws:secretsmanager:us-east-1:123456789012:secret:serverless-test1'

def example_driver_for_sqlalchemy():
    from sqlalchemy.engine import create_engine
    engine = create_engine(
        'mysql+pydataapi://',
        connect_args={
            'resource_arn': 'arn:aws:rds:us-east-1:123456789012:cluster:dummy',
            'secret_arn': 'arn:aws:secretsmanager:us-east-1:123456789012:secret:dummy',
            'database': 'test'}
    )

    result = engine.execute("select * from pets")
    print(result.fetchall())

def example_simple_execute():
    data_api = DataAPI(resource_arn=resource_arn, secret_arn=secret_arn, database=database)
    result: Result = data_api.execute('show tables')
    print(result.scalar())
    # Pets

Contributing to pydataapi

We are waiting for your contributions to pydataapi.

How to contribute

https://koxudaxi.github.io/py-data-api/contributing

Related projects

local-data-api

DataAPI Server for local

https://github.com/koxudaxi/local-data-api

PyPi

https://pypi.org/project/pydataapi

Source Code

https://github.com/koxudaxi/py-data-api

Documentation

https://koxudaxi.github.io/py-data-api

License

py-data-api is released under the MIT License. http://www.opensource.org/licenses/mit-license

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

pydataapi-0.4.24.tar.gz (27.9 kB view details)

Uploaded Source

Built Distribution

pydataapi-0.4.24-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

File details

Details for the file pydataapi-0.4.24.tar.gz.

File metadata

  • Download URL: pydataapi-0.4.24.tar.gz
  • Upload date:
  • Size: 27.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for pydataapi-0.4.24.tar.gz
Algorithm Hash digest
SHA256 f048d8fcbaa2c4d791f02b78887f9f884e2f31d2965e119acec97ba490114d6d
MD5 5ac850590000ebd347a5e2ad7e1214e6
BLAKE2b-256 022eb9498c416f02824739a42edb86af5658d1e9748e6701949c62f02e9b90b1

See more details on using hashes here.

File details

Details for the file pydataapi-0.4.24-py3-none-any.whl.

File metadata

  • Download URL: pydataapi-0.4.24-py3-none-any.whl
  • Upload date:
  • Size: 26.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for pydataapi-0.4.24-py3-none-any.whl
Algorithm Hash digest
SHA256 b4d122db2e0977ea66a7f23b3b446ab9d629157172b6c234649bc07d4d80f64a
MD5 895709f2fd16ed66d8c4a1022222abcb
BLAKE2b-256 aadfc696ae6f92cf9cd133bc5ceb1c9f18fee6b5ba96513e72261597b85e7ff5

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