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.

Files for duosql, version 0.1.8
Filename, size File type Python version Upload date Hashes
Filename, size duosql-0.1.8-py3-none-any.whl (4.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size duosql-0.1.8.tar.gz (3.5 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page