deploydb

Deploy your database objects automatically when the git branch is updated.

  • Production-ready! βš™οΈ
  • Easy-to-use πŸ”¨
  • Customizable πŸ”§

Installation

Install the latest package. pip install deploydb

Usage

1- Create configuration file ( json file or dict )

Property Description
local_path where the local repository will be located
https_url or ssh_url address to be listen
target_branch branch to handle changes
servers a list of server credentials

Example: config.json

{
    "local_path": "",
    "https_url": "",
    "ssh_url": "",
    "target_branch": "",
    "servers": [
        {
            "driver": "ODBC Driver 17 for SQL Server",
            "server": "server-address-or-instance-name",
            "server_alias": "Staging",
            "user": "your-username",
            "passw": "your-password"
        }
    ]
}

2- Listener will listen every changes with sync method.

from deploydb import Listener

deploy = Listener('config.json')
deploy.sync(loop=True)

Repo Generator

If you does not have any existing repository. You can easily export your database objects then create your repository.

from deploydb import RepoGenerator

scripter = RepoGenerator(
    config="config.json",
    export_path="path-to-export",
    databases=[]  #Β Default takes all databases from the given credential if not specified.
)
scripter.run()

RepoGenerator will extract objects structure as below.

path-to-export
β”‚
└───Server-X
    β”‚    └───DB-X
    β”‚    β”‚   └───Tables
    β”‚    β”‚   └───Views
    β”‚    β”‚   └───Functions
    β”‚    β”‚   └───Stored-Procedures
    β”‚    β”‚   └───Triggers
    β”‚    β”‚   └───Types
    β”‚    β”‚   └───DMLs
    β”‚    β”‚   └───DDLs
    |    |
    β”‚    N-Database
    N-Server

TODO

  • Creating Services for Continuous Integration

    • Windows Service
    • Linux Systemd Service
  • Getting Notifications

    • Microsoft Teams Webhook Integration
    • Slack Webhook Integration

GitHub

View Github