Metadata-Version: 2.1
Name: ddbsh
Version: 0.12.7
Summary: ddbsh, the DynamoDB shell, as a Python library: SQL-like statements against Amazon DynamoDB
Keywords: dynamodb,aws,sql,shell,dbapi
Author: ddbsh contributors
License: Apache-2.0
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: C++
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Database :: Front-Ends
Project-URL: Homepage, https://www.ddbsh.org/
Project-URL: Source, https://github.com/awslabs/dynamodb-shell
Project-URL: Documentation, https://github.com/awslabs/dynamodb-shell/blob/main/docs/PYTHON.md
Project-URL: Issues, https://github.com/awslabs/dynamodb-shell/issues
Requires-Python: >=3.9
Requires-Dist: boto3>=1.26
Provides-Extra: test
Requires-Dist: pytest>=7; extra == "test"
Description-Content-Type: text/markdown

<!--
Copyright 2026 ddbsh reimplementation contributors.
SPDX-License-Identifier: Apache-2.0
-->

# ddbsh for Python

[ddbsh](https://github.com/awslabs/dynamodb-shell), the DynamoDB shell, as a
Python library. Write SQL-like statements; ddbsh turns each one into the
cheapest DynamoDB call (GetItem, Query or Scan) and returns the rows.

The package contains the same C++ engine the `ddbsh` command uses, so a
statement makes the same DynamoDB requests and prints the same text. Requests
are signed and sent with botocore, so credentials, regions, profiles and roles
work as they do in boto3 (including AWS Lambda).

```
pip install ddbsh
```

## Text, exactly as the command prints it

```python
import ddbsh

conn = ddbsh.connect()                      # the default boto3 session
print(conn.run('select * from movies where id = "m1";'))
print(conn.run("select * from movies;", format="json"))
```

## A DB-API 2.0 cursor

```python
cur = conn.cursor()
cur.execute("select * from movies where id = ? and yr = ?;", ["m1", 2010])
for row in cur:                             # rows are dicts
    print(row["title"])                     # N values are decimal.Decimal

cur.execute("update movies set rating = ? where id = ?;", [5, "m1"])
print(cur.write_result)                     # WriteResult(verb='UPDATE', ...)
```

## Offline

```python
conn = ddbsh.connect_memory()               # an in-memory store, no AWS
conn.run("create table t ( id string ) primary key ( id hash );")
```

The full guide (connections, credentials, Lambda, the type mapping, errors,
threads) is
[docs/PYTHON.md](https://github.com/awslabs/dynamodb-shell/blob/main/docs/PYTHON.md).

Wheels are published for CPython 3.9 to 3.13 on Linux (x86_64 and aarch64,
glibc 2.28 or later), macOS 13.3 or later (arm64 and x86_64) and Windows x64.
[`libddbsh`](https://pypi.org/project/libddbsh/) is another name for this
package.

Licensed under the Apache License 2.0.
