Skip to main content

An easy way to demo database transactions.

Project description

duosql

An easy way to demonstrate database transactions.

Prerequisite

  • Python 3.5+
  • tmux

Install

pip3 install duosql

Usage

  1. Create a .duo script file. For example:
# connect command
connect: mysql -ujohnlinp -psecret somedb

# create table and populate data
left: DROP TABLE IF EXISTS person;
left: CREATE TABLE person (id INT NOT NULL AUTO_INCREMENT, name VARCHAR(255) NOT NULL, age INT NOT NULL, PRIMARY KEY (id));
left: INSERT INTO person (name, age) VALUES ('John Lin', 29);

# start left transaction
left: SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
left: BEGIN;
left: SELECT age FROM person WHERE id = 1;

# start right transaction
right: BEGIN;
right: UPDATE person SET age = 30 WHERE id = 1;

# continue left transaction
left: SELECT age FROM person WHERE id = 1;

# continue right transaction
right: ROLLBACK;
  1. Run duosql <script-file>.

  2. Watch.

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

duosql-0.1.8.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

duosql-0.1.8-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file duosql-0.1.8.tar.gz.

File metadata

  • Download URL: duosql-0.1.8.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/2.7.16

File hashes

Hashes for duosql-0.1.8.tar.gz
Algorithm Hash digest
SHA256 9c1dcc159a41a614b03c7ea7f031e6608ecfdb8e3bbdf9cca8f47da2b15b9e85
MD5 7c0f58bf1192988021f5cd3b38ce38b6
BLAKE2b-256 382ea2da119cfadf2c3b3960137c69d58b80b989c7826a1b3f06aace0f74ca8a

See more details on using hashes here.

File details

Details for the file duosql-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: duosql-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/2.7.16

File hashes

Hashes for duosql-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 c6a7d351b0ac4b5158f95b399380a62cbf68bcd5ab4fc1c6d63bbb46f119d4d6
MD5 7e54bf19710ae5e5c1491d83213e9182
BLAKE2b-256 c2f464e116a3dfabb84eab0a333a818ddf03bf6ecd27d04a0f2d98efd856ff66

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