You can run the DatabaseCI client in two ways - via command line, or as a Python library. Either way, you'll need to install the PyPI package first up.

Step 1: Install the databaseci Python module from PyPI

Install DatabaseCI with your preferred Python package manager. With pip, that looks like:

pip install databaseci

Step 2: Create an API key, and put it a config file

You can create an API Key at this link.

Create a config file (call it whatever you like but we'll assume it's called databaseci.yml), and add your API key as follows (using c72cc... as an example API key):

api_key: c72cc5a97000d49bb33abd48ac730cc2

Make sure you replace it with your own key.

Step 3: Add your production and copy database information.

To make a subset, you'll need a source database (usually that will be your production database), and an empty database in which your subsetted copy will be created.

Create your empty database (probably on a local Postgres instance or in a locally running container), and add the connection URLs to your config file as follows:

api_key: c72cc5a97000d49bb33abd48ac730cc2

real_db_url: postgresql://production.server.example.com/production
copy_db_url: postgresql:///subsetted

Step 4: Run the check to make sure your connection settings are correct

Run a basic check as follows:

databaseci check databaseci.yaml

You should see output similar to the following:

"Connection successful - valid API key."

"Checking production database connectivity..."
"Prod connection successful."

"Checking copy/destination database connectivity..."
"Copy/destination connection successful."

Otherwise, you may need to check your API key and connection strings for correctness - if any issues persist, don't hesitate to reach out to [email protected] and we'll help sort them out.

Next step: Do your first run.

Give feedback