Amazon QLDB driver for Python
Important
End of support notice: Existing customers will be able to use Amazon QLDB until end of support on 07/31/2025. For more details, see
Migrate an Amazon QLDB Ledger to Amazon Aurora PostgreSQL
To work with data in your ledger, you can connect to Amazon QLDB from your Python application by using an AWS provided driver. The following topics describe how to get started with the QLDB driver for Python.
Driver resources
For more information about the functionality supported by the Python driver, see the following resources:
Prerequisites
Before you get started with the QLDB driver for Python, you must do the following:
-
Follow the AWS setup instructions in Accessing Amazon QLDB. This includes the following:
-
Sign up for AWS.
-
Create a user with the appropriate QLDB permissions.
-
Grant programmatic access for development.
-
-
Install one of the following versions of Python from the Python downloads
site: -
3.6 or later – QLDB driver for Python v3
-
3.4 or later – QLDB driver for Python v2
-
-
Set up your AWS credentials and your default AWS Region. For instructions, see Quickstart
in the AWS SDK for Python (Boto3) documentation. For a complete list of available Regions, see Amazon QLDB endpoints and quotas in the AWS General Reference.
Next, you can download the complete tutorial sample application—or you can install only the driver in a Python project and run short code examples.
-
To install the QLDB driver and the AWS SDK for Python (Boto3) in an existing project, proceed to Installation.
-
To set up a project and run short code examples that demonstrate basic data transactions on a ledger, see the Quick start tutorial.
-
To run more in-depth examples of both data and management API operations in the complete tutorial sample application, see the Python tutorial.
Installation
QLDB supports the following driver versions and their Python dependencies.
To install the QLDB driver from PyPI using pip
(a package manager for
Python), enter the following at the command line.
Installing the driver also installs its dependencies, including the AWS SDK for Python (Boto3)
Using the driver to connect to a ledger
Then you can import the driver and use it to connect to a ledger. The following Python code example shows how to create a session for a specified ledger name.
For short code examples of how to run basic data transactions on a ledger, see the Cookbook reference.