Skip to main content

A simple yaml to database updater

Project description

ConfigCobra v0.1.6

This is a basic project to provide a way to deploy database configuration to remote databases via pipelines. The basic premise is that we can control the config via yaml file declarations. These yaml files provide instructions on what operation should be performed on data and the fields associated with it.

This is the initial version and the feature set is somewhat limited but useful for my purposes.


features

Features in v0.1.6 of ConfigCobra

  • postgres data deployments
  • Supports standard CRUD operations
  • basic local validation of fields supplied against a list of columns
  • flexible pk field names

Database connection is controlled by environment variables since the intended use case for this is inside a container

for example:

CONFIG_COBRA_DB_NAME=load-test
CONFIG_COBRA_DB_USER=user-name
CONFIG_COBRA_DB_PASSWORD=strong-password
CONFIG_COBRA_DB_HOST=localhost
CONFIG_COBRA_DB_PORT=54321

This software is offered without warranty or obligation.

Contributions to the base that is here is welcome via pull requests. Please ensure any contributions are clearly defined. If they don't match with the goals of the project they will be rejected. If you wish to fork then go for it!

Usage

Currently takes on arg to a valid yaml file:

config-cobra --yaml_file %path_to_the_yaml%

YAML format

The yaml file serves as the instructions about what we should do in any particular operation.

The current actions supported in this version are:

  • insert
  • update
  • update_or_insert
  • delete

Examples:

to insert

deploy: 
  - table: simple_table
    pk: id
    action: insert
    types:
      id: string
      name: string
      age: int
      json: json
    data:
      - id: 1
        name: John
        age: 30
        json: |
          {
            "key1": "value1",
            "key2": "value2"
          }
      - id: 2
        name: Jane
        age: 25
        json: |
          {
            "key1": "value1",
            "key2": "value2"
          }

To update

deploy:
  - table: simple_table
    pk: id
    action: update
    types:
      id: string
      name: string
      age: int
      json: json
    data:
      - id: 1
        name: John
        age: 30
        json: |
          {
            "key1": "value1",
            "key2": "value2"
          }
      - id: 2
        name: Jane
        age: 25
        json: |
          {
            "key1": "value1",
            "key2": "value2"
          }

To update or insert

  - table: simple_table
    pk: id
    action: update_or_insert
    types:
      id: string
      name: string
      age: int
      json: json
    data:
      - id: 7
        name: Bob
        age: 88
        json: |
          {
            "key1": "value1",
            "key2": "value2"
          }

To delete

deploy: 
  - table: simple_table
    pk: id
    action: delete
    types:
      id: string
      name: string
      age: int
      json: json
    data:
      - id: 1
      - id: 2
      - id: 7

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

config-cobra-0.1.6.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

config_cobra-0.1.6-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file config-cobra-0.1.6.tar.gz.

File metadata

  • Download URL: config-cobra-0.1.6.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.12

File hashes

Hashes for config-cobra-0.1.6.tar.gz
Algorithm Hash digest
SHA256 bf13afdcb088ad25b1769491a4114f8ce2d079868102ec5d4b9571e14738e807
MD5 2b2b128f2b1b659a472c5e8164fb9fd1
BLAKE2b-256 dd58ca02d35e2f17d13a072812faf184e6abd913fafffc84068a732649cae88c

See more details on using hashes here.

File details

Details for the file config_cobra-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: config_cobra-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.12

File hashes

Hashes for config_cobra-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 5fe764e375ef8fca6dafda8b091ab373f69bc2fbfb8162b27e079965546faef7
MD5 9bde4b93b028626b255673530320833d
BLAKE2b-256 ca1fd0f1bf3e81386ebafff2c8a2ac81fd8c860700fea6dbf5dbb2414593581d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page