Skip to main content

What is Xalanih ?

Xalanih is a python script made to help you version your SQL database. You can use it to manage the creation or update the database of your project.

Technical Requirements

  • Python 3.6
  • mysqlclient
  • sqlparse

How to install Xalanih

pip3 install xalanih

How to use Xalanih

Create the db

python3 -m xalanih create <database>

where <database> must be replaced by the name of the database.

Update the db

python3 -m xalanih update <database>

where <database> must be replaced by the name of the database.

Options

Differents options can be given to the script. You can find all of them using the following command:

python3 xalanih -h

Working directory

-d <directory>

Specify the directory where all the database scripts are.

Default value: "."

Database type

-t <type>

Specify the type of database to which the script has to connect.

Accepted value: mysql | Default value: mysql

Host

-H <host>

The address of the host of the database.

Default value: localhost

Port

-p <port>

The port of the database.

Default value: 3306

User

-u <user>

The user used to connect

Default value: root

Password

-pwd <password>

The password used to connect to the database.

Socket

-s <socket>

The path to the mysql socket if it is not at the default location (/tmp/mysql.sock).

Logging

These options are linked to the logging.

Verbosity

-v <verbosity>

The verbosity of the logs in standard output.

Accepted values: 0,1,2,3,4 | Default value: 3

  • 0: No logs.
  • 1: Only errors.
  • 2: Errors and warnings.
  • 3: Informations, warnings and errors.
  • 4: Debugs, informations, warnings and errors.

Log file

-l <filename>

The name of the file where the logs are saved. It is not affected by the verbosity options (It is always set at 4). If no file specified, no file are created.

last update

-to <update>

Define the last update that will be applied. Must be an update not included in included_updates.

no update

-nu

Has only an effect with the create option. If specified, the script will only execute the creation script and will not apply the updates.

How to structure the directory containing the database scripts

The structure to use for the directory that contains all the scripts you have for your database.

L creation (directory)
    L  creation.sql (file)
    L  included_updates (file)
L update (directory)
    L  script01.sql (file)
    L  ...

creation (directory)

The creation directory will contains the scripts that will be used to create the baseline of the database. These will only be called when the database is created from zero. That means that they will not be used in case of a database update.

creation.sql (file)

The script creation.sql is the entrypoint of Xalanih to create the database. This file must contains all the needed script to create the baseline of your database.

included_updates (file)

When you will have a lot of update file, you will want to create the database directly with these modification instead of applying them after. In order to do that, you will have to add the modification directly to your creation.sql. But in order for Xalanih to not apply the update scripts, you have to add the name of all update scripts already integrated to the file included_updates. There should be one filename by line.

update (directory)

The update directory must contains all your update scripts (and nothing else). There is not realy a nomenclature for the update scripts but the alphabetical order should correspond to their chronological order. Also, no patch can be named initial_install. This is because this name is associated to the creation of the database

Table created by xalanih: xalanih_updates

The table xalanih_patches contains 3 columns: id, update_name, and update_apply_time. It is used by the script to detect which patches have already been applied. The patch name associated to the initial creation of the database is initial_install.

Release files for xalanih 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xalanih 1.0.0
File Size Uploaded
xalanih-1.0.0.tar.gz 12.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for xalanih 1.0.0
File Interpreter ABI Platform
xalanih-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 32.2 kB

Release files / xalanih-1.0.0.tar.gz

Download URL xalanih-1.0.0.tar.gz
Size 12.8 kB
Tags Source
SHA-256 checksum
How to use checksums
288e52925af6d5dfe959b4f572d410f1357d3f422ee48fe8071fb0e26cd63d39
BLAKE2b-256 checksum
How to use checksums
bc9509f112ab19009148999794e47af53efe0caaa74d1bf409fca02368150670
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / xalanih-1.0.0-py3-none-any.whl

Download URL xalanih-1.0.0-py3-none-any.whl
Size 19.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7a4ccaa4f5624e9252639cf6ab7a06b2f58a4b3b75e0c929f1098910c5731d20
BLAKE2b-256 checksum
How to use checksums
8e01e6db2b4bcfdd9b3e0c245ccd931d5ae1c98e88a9c2f4d63b5ddccfebdc28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page