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
- 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;
-
Run
duosql <script-file>
. -
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 hashes)
Built Distribution
duosql-0.1.8-py3-none-any.whl
(4.6 kB
view hashes)