https://github.com/koxudaxi/py-data-api
A user-friendly client for AWS Aurora Serverless's Data API
https://github.com/koxudaxi/py-data-api
api aurora aws aws-aurora client data-api dataapi db-api orm python python3 serverless sql sqlalchemy
Last synced: 5 months ago
JSON representation
A user-friendly client for AWS Aurora Serverless's Data API
- Host: GitHub
- URL: https://github.com/koxudaxi/py-data-api
- Owner: koxudaxi
- License: mit
- Created: 2019-06-03T15:01:04.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-12-09T14:29:35.000Z (about 4 years ago)
- Last Synced: 2024-12-28T06:24:52.241Z (about 1 year ago)
- Topics: api, aurora, aws, aws-aurora, client, data-api, dataapi, db-api, orm, python, python3, serverless, sql, sqlalchemy
- Language: Python
- Homepage: https://koxudaxi.github.io/py-data-api
- Size: 2.7 MB
- Stars: 40
- Watchers: 4
- Forks: 8
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Contributing: docs/contributing.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# py-data-api - Data API Client for Python
[](https://github.com/koxudaxi/py-data-api/actions)
[](https://badge.fury.io/py/pydataapi)
[](https://pypi.python.org/pypi/pydataapi)
[](https://codecov.io/gh/koxudaxi/py-data-api)

[](https://github.com/psf/black)
py-data-api is a client for Data API of [Aurora Serverless](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/data-api.html).
Also, the package includes SQLAlchemy Dialects and DB API 2.0 Client.
## Features
- SQLAlchemy Dialects
- DB API 2.0 compatible client [PEP 249](https://www.python.org/dev/peps/pep-0249/)
## 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
```bash
$ pip install pydataapi
```
## Example
```python
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](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](https://pypi.org/project/pydataapi)
## Source Code
[https://github.com/koxudaxi/py-data-api](https://github.com/koxudaxi/py-data-api)
## Documentation
[https://koxudaxi.github.io/py-data-api](https://koxudaxi.github.io/py-data-api)
## License
py-data-api is released under the MIT License. http://www.opensource.org/licenses/mit-license