.. |badge package| image:: https://badge.fury.io/py/pydynamodb.svg
:target: https://badge.fury.io/py/pydynamodb
.. |badge test| image:: https://github.com/passren/PyDynamoDB/actions/workflows/run-test.yaml/badge.svg
:target: https://github.com/passren/PyDynamoDB/actions/workflows/run-test.yaml
.. |badge downloads| image:: https://static.pepy.tech/badge/pydynamodb/month
:target: https://pepy.tech/project/pydynamodb
.. |badge formation| image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
.. |badge codcov| image:: https://codecov.io/github/passren/PyDynamoDB/branch/main/graph/badge.svg?token=Y5DG320O76
:target: https://codecov.io/github/passren/PyDynamoDB
.. |badge sqrelia| image:: https://sonarcloud.io/api/project_badges/measure?project=passren_PyDynamoDB&metric=reliability_rating
:target: https://sonarcloud.io/summary/new_code?id=passren_PyDynamoDB
.. |badge sqale| image:: https://sonarcloud.io/api/project_badges/measure?project=passren_PyDynamoDB&metric=sqale_rating
:target: https://sonarcloud.io/summary/new_code?id=passren_PyDynamoDB
.. |badge sqvuln| image:: https://sonarcloud.io/api/project_badges/measure?project=passren_PyDynamoDB&metric=vulnerabilities
:target: https://sonarcloud.io/summary/new_code?id=passren_PyDynamoDB
|badge package| |badge test| |badge downloads| |badge formation| |badge codcov|
|badge sqrelia| |badge sqale| |badge sqvuln|
PyDynamoDB
===========
PyDynamoDB is a Python `DB API 2.0 (PEP 249)`_ client for `Amazon DynamoDB`_.
SQLAlchemy dialect supported as well.
.. _`DB API 2.0 (PEP 249)`: https://www.python.org/dev/peps/pep-0249/
.. _`Amazon DynamoDB`: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Introduction.html
Objectives
----------
PyDynamoDB implement the DB API 2.0 interfaces based on `PartiQL`_ supported by AWS DynamoDB. \
Although PartiQL can only support DML operations (INSERT, UPDATE, DELETE, SELECT), PyDynamoDB \
extended the capabilities to support DDL as well. Now you are able to use MySQL-like statements \
to CREATE/ALTER/DROP tables. Besides DDL statements, some of utility statements are allowed to \
execute (Such as, List and Describe Table). \
PyDynamodb provide parameters and result_set converter to make you easily manipulate operations \
with Python built-in types. \
Transaction is also partially supported with DB standard operations, like begin() and commit().
.. _`PartiQL`: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ql-reference.html
.. _`PyAthena`: https://github.com/laughingman7743/PyAthena
Features
---------
* Compatible with DB API 2.0 Specification
* PartiQL for DML operations (INSERT, UPDATE, DELETE, SELECT)
* Limit supported in SELECT statement
* Extra type conversion and string functions supported in SELECT statement
* Column alias supported in SELECT statement
* MySQL-Like statements for DDL operations (CREATE TABLE, ALTER TABLE, DROP TABLE)
* MySQL-Like statements for Utility operations (LIST/SHOW TABLES, DESC TABLE)
* Auto data type conversion for parameters and result set (Including date and datetime)
* Transaction and Batch operations
* SQLAlchemy dialect provided
* Compatible for Superset SQL Lab and graphing
Requirements
--------------
* Python
- CPython 3.8 3.9 3.10 3.11 3.12
Dependencies
--------------
* Boto3 (Python SDK for AWS Services)
- boto3 >= 1.21.0
- botocore >= 1.24.7
* Tenacity (Retry Utility for API calling)
- tenacity >= 4.1.0
* SQLAlchemy (The ORM Toolkit for Python, only required if using PyDynamoDB Dialect)
- SQLAlchemy >= 1.0.0
* Pyparsing (The approach to creating and executing simple grammars)
- pyparsing >= 3.0.0
Installation
--------------
.. code:: shell
pip install pydynamodb
Guidances
--------------
To get more documentation, please visit: `PyDynamoDB WIKI`_.
.. _`PyDynamoDB WIKI`: https://github.com/passren/PyDynamoDB/wiki
Basic usage
~~~~~~~~~~~
.. code:: python
from pydynamodb import connect
cursor = connect(aws_access_key_id="aws_access_key_id",
aws_secret_access_key="aws_secret_access_key",
region_name="region_name").cursor()
cursor.execute('SELECT * FROM "ddb_table_name"')
print(cursor.fetchall())
Cursor iteration
~~~~~~~~~~~~~~~~
.. code:: python
from pydynamodb import connect
cursor = connect(aws_access_key_id="aws_access_key_id",
aws_secret_access_key="aws_secret_access_key",
region_name="region_name").cursor()
cursor.execute('SELECT * FROM "ddb_table_name"')
rows = cursor.fetchall()
for row in rows:
print(row)
Query with parameters
~~~~~~~~~~~~~~~~~~~~~~
PyDynamoDB is able to serialize the parameters which passed to DDB \
and deserialize the response to Python built-in types.
.. code:: python
from pydynamodb import connect
from datetime import date, datetime
cursor = connect(aws_access_key_id="aws_access_key_id",
aws_secret_access_key="aws_secret_access_key",
region_name="region_name").cursor()
cursor.execute("""INSERT INTO "ddb_table_name" VALUE {
'partition_key' = ?, 'sort_key' = ?, 'col_str' = ?,
'col_num' = ?, 'col_byte' = ?, 'col_ss' = ?,
'col_ns' = ?, 'col_bs' = ?, 'col_list' = ?,
'col_map' = ?, 'col_nested' = ?,
'col_date' = ?, 'col_datetime' = ?
}""", ["pkey_value", "skey_value", "str", 100, b"ABC", # String, Number, Bytes
{"str", "str"}, {100, 100}, {b"A", b"B"}, # String/Numnber/Bytes Set
["str", 100, b"ABC"], # List
{"key1": "val", "key2": "val"}, # Map
["str", 100, {"key1": "val"}], # Nested Structure
date(2022, 10, 18), datetime(2022, 10, 18, 13, 55, 34), # Date and Datetime Type
])
cursor.execute('SELECT * FROM "ddb_table_name" WHERE partition_key = ?', ["key_value"])
print(cursor.fetchall())
License
=======
PyDynamoDB is distributed under the `MIT license
<https://opensource.org/licenses/MIT>`_.
Raw data
{
"_id": null,
"home_page": "https://github.com/passren/PyDynamoDB",
"name": "PyDynamoDB",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "DB-API Amazon AWS DynamoDB",
"author": "Peng Ren",
"author_email": "passren9099@hotmail.com",
"download_url": "https://files.pythonhosted.org/packages/d4/8f/ebb339cd3e801a5f8002fd3c4ba19ac82750d8ea7990411eb0ef7ab5eace/PyDynamoDB-0.7.1.tar.gz",
"platform": null,
"description": ".. |badge package| image:: https://badge.fury.io/py/pydynamodb.svg\n :target: https://badge.fury.io/py/pydynamodb\n\n.. |badge test| image:: https://github.com/passren/PyDynamoDB/actions/workflows/run-test.yaml/badge.svg\n :target: https://github.com/passren/PyDynamoDB/actions/workflows/run-test.yaml\n\n.. |badge downloads| image:: https://static.pepy.tech/badge/pydynamodb/month\n :target: https://pepy.tech/project/pydynamodb\n\n.. |badge formation| image:: https://img.shields.io/badge/code%20style-black-000000.svg\n :target: https://github.com/psf/black\n\n.. |badge codcov| image:: https://codecov.io/github/passren/PyDynamoDB/branch/main/graph/badge.svg?token=Y5DG320O76 \n :target: https://codecov.io/github/passren/PyDynamoDB\n\n.. |badge sqrelia| image:: https://sonarcloud.io/api/project_badges/measure?project=passren_PyDynamoDB&metric=reliability_rating \n :target: https://sonarcloud.io/summary/new_code?id=passren_PyDynamoDB\n\n.. |badge sqale| image:: https://sonarcloud.io/api/project_badges/measure?project=passren_PyDynamoDB&metric=sqale_rating \n :target: https://sonarcloud.io/summary/new_code?id=passren_PyDynamoDB\n\n.. |badge sqvuln| image:: https://sonarcloud.io/api/project_badges/measure?project=passren_PyDynamoDB&metric=vulnerabilities \n :target: https://sonarcloud.io/summary/new_code?id=passren_PyDynamoDB\n\n|badge package| |badge test| |badge downloads| |badge formation| |badge codcov| \n|badge sqrelia| |badge sqale| |badge sqvuln|\n\nPyDynamoDB\n===========\n\nPyDynamoDB is a Python `DB API 2.0 (PEP 249)`_ client for `Amazon DynamoDB`_. \nSQLAlchemy dialect supported as well.\n\n.. _`DB API 2.0 (PEP 249)`: https://www.python.org/dev/peps/pep-0249/\n.. _`Amazon DynamoDB`: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Introduction.html\n\n\nObjectives\n----------\nPyDynamoDB implement the DB API 2.0 interfaces based on `PartiQL`_ supported by AWS DynamoDB. \\\nAlthough PartiQL can only support DML operations (INSERT, UPDATE, DELETE, SELECT), PyDynamoDB \\\nextended the capabilities to support DDL as well. Now you are able to use MySQL-like statements \\\nto CREATE/ALTER/DROP tables. Besides DDL statements, some of utility statements are allowed to \\\nexecute (Such as, List and Describe Table). \\\nPyDynamodb provide parameters and result_set converter to make you easily manipulate operations \\\nwith Python built-in types. \\\nTransaction is also partially supported with DB standard operations, like begin() and commit().\n\n\n.. _`PartiQL`: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ql-reference.html\n.. _`PyAthena`: https://github.com/laughingman7743/PyAthena\n\n\nFeatures\n---------\n* Compatible with DB API 2.0 Specification\n* PartiQL for DML operations (INSERT, UPDATE, DELETE, SELECT)\n* Limit supported in SELECT statement\n* Extra type conversion and string functions supported in SELECT statement\n* Column alias supported in SELECT statement\n* MySQL-Like statements for DDL operations (CREATE TABLE, ALTER TABLE, DROP TABLE)\n* MySQL-Like statements for Utility operations (LIST/SHOW TABLES, DESC TABLE)\n* Auto data type conversion for parameters and result set (Including date and datetime)\n* Transaction and Batch operations\n* SQLAlchemy dialect provided\n* Compatible for Superset SQL Lab and graphing\n\n\nRequirements\n--------------\n* Python\n\n - CPython 3.8 3.9 3.10 3.11 3.12\n\nDependencies\n--------------\n* Boto3 (Python SDK for AWS Services)\n\n - boto3 >= 1.21.0\n - botocore >= 1.24.7\n\n* Tenacity (Retry Utility for API calling)\n\n - tenacity >= 4.1.0\n\n* SQLAlchemy (The ORM Toolkit for Python, only required if using PyDynamoDB Dialect)\n\n - SQLAlchemy >= 1.0.0\n\n* Pyparsing (The approach to creating and executing simple grammars)\n\n - pyparsing >= 3.0.0\n\nInstallation\n--------------\n.. code:: shell\n\n pip install pydynamodb\n\n\nGuidances\n--------------\nTo get more documentation, please visit: `PyDynamoDB WIKI`_.\n\n.. _`PyDynamoDB WIKI`: https://github.com/passren/PyDynamoDB/wiki\n\n\nBasic usage\n~~~~~~~~~~~\n\n.. code:: python\n\n from pydynamodb import connect\n\n cursor = connect(aws_access_key_id=\"aws_access_key_id\",\n aws_secret_access_key=\"aws_secret_access_key\",\n region_name=\"region_name\").cursor()\n cursor.execute('SELECT * FROM \"ddb_table_name\"')\n print(cursor.fetchall())\n\n\nCursor iteration\n~~~~~~~~~~~~~~~~\n\n.. code:: python\n\n from pydynamodb import connect\n\n cursor = connect(aws_access_key_id=\"aws_access_key_id\",\n aws_secret_access_key=\"aws_secret_access_key\",\n region_name=\"region_name\").cursor()\n cursor.execute('SELECT * FROM \"ddb_table_name\"')\n rows = cursor.fetchall()\n for row in rows:\n print(row)\n\n\nQuery with parameters\n~~~~~~~~~~~~~~~~~~~~~~\n\nPyDynamoDB is able to serialize the parameters which passed to DDB \\\nand deserialize the response to Python built-in types.\n\n.. code:: python\n\n from pydynamodb import connect\n from datetime import date, datetime\n cursor = connect(aws_access_key_id=\"aws_access_key_id\",\n aws_secret_access_key=\"aws_secret_access_key\",\n region_name=\"region_name\").cursor()\n cursor.execute(\"\"\"INSERT INTO \"ddb_table_name\" VALUE {\n 'partition_key' = ?, 'sort_key' = ?, 'col_str' = ?,\n 'col_num' = ?, 'col_byte' = ?, 'col_ss' = ?,\n 'col_ns' = ?, 'col_bs' = ?, 'col_list' = ?,\n 'col_map' = ?, 'col_nested' = ?,\n 'col_date' = ?, 'col_datetime' = ?\n }\"\"\", [\"pkey_value\", \"skey_value\", \"str\", 100, b\"ABC\", # String, Number, Bytes\n {\"str\", \"str\"}, {100, 100}, {b\"A\", b\"B\"}, # String/Numnber/Bytes Set\n [\"str\", 100, b\"ABC\"], # List\n {\"key1\": \"val\", \"key2\": \"val\"}, # Map\n [\"str\", 100, {\"key1\": \"val\"}], # Nested Structure\n date(2022, 10, 18), datetime(2022, 10, 18, 13, 55, 34), # Date and Datetime Type\n ])\n\n cursor.execute('SELECT * FROM \"ddb_table_name\" WHERE partition_key = ?', [\"key_value\"])\n print(cursor.fetchall())\n\n\nLicense\n=======\n\nPyDynamoDB is distributed under the `MIT license\n<https://opensource.org/licenses/MIT>`_.\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python DB API 2.0 (PEP 249) client for Amazon DynamoDB",
"version": "0.7.1",
"project_urls": {
"Documentation": "https://github.com/passren/PyDynamoDB/wiki",
"Homepage": "https://github.com/passren/PyDynamoDB",
"Source": "https://github.com/passren/PyDynamoDB",
"Tracker": "https://github.com/passren/PyDynamoDB/issues"
},
"split_keywords": [
"db-api",
"amazon",
"aws",
"dynamodb"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7990e43ac9a7868f2eaac29b98c05d45ef79d1d985ba08da7db2e3fd1a658b78",
"md5": "ebb50cccceb0e5b969cafde4efd99080",
"sha256": "2cf70cce15d9e83e153d49d02b4757fecdc6bf613b4dfca75439c7efc4ba1b7a"
},
"downloads": -1,
"filename": "PyDynamoDB-0.7.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ebb50cccceb0e5b969cafde4efd99080",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 57090,
"upload_time": "2024-11-27T03:18:01",
"upload_time_iso_8601": "2024-11-27T03:18:01.078252Z",
"url": "https://files.pythonhosted.org/packages/79/90/e43ac9a7868f2eaac29b98c05d45ef79d1d985ba08da7db2e3fd1a658b78/PyDynamoDB-0.7.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d48febb339cd3e801a5f8002fd3c4ba19ac82750d8ea7990411eb0ef7ab5eace",
"md5": "03d5fe1dbc68891042d3ed1b25ea31e7",
"sha256": "95615a0ecb8c9a071f138cafd1f976e78d071b0f9a7f5105b9a4f11880c1b6bf"
},
"downloads": -1,
"filename": "PyDynamoDB-0.7.1.tar.gz",
"has_sig": false,
"md5_digest": "03d5fe1dbc68891042d3ed1b25ea31e7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 43803,
"upload_time": "2024-11-27T03:18:02",
"upload_time_iso_8601": "2024-11-27T03:18:02.857770Z",
"url": "https://files.pythonhosted.org/packages/d4/8f/ebb339cd3e801a5f8002fd3c4ba19ac82750d8ea7990411eb0ef7ab5eace/PyDynamoDB-0.7.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-27 03:18:02",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "passren",
"github_project": "PyDynamoDB",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pydynamodb"
}