Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/slott56/unlearning-sql
The examples from the Unlearning SQL book
https://github.com/slott56/unlearning-sql
Last synced: 7 days ago
JSON representation
The examples from the Unlearning SQL book
- Host: GitHub
- URL: https://github.com/slott56/unlearning-sql
- Owner: slott56
- License: mit
- Created: 2022-07-06T20:23:21.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-19T19:12:04.000Z (3 months ago)
- Last Synced: 2024-08-20T22:55:53.829Z (3 months ago)
- Language: Python
- Size: 19.3 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
################
unlearning-sql
################Components and examples from the Unlearning SQL book.
Installation
=============There are several steps to getting this ready for experimentation.
1. Create a virtual environment with Python 3.12.
Use venv or Poetry or hatch or conda.Conda example:
.. code-block:: bash
conda create -n unlearning-sql python=3.12
conda activate unlearning-sql2. Clone or download this https://github.com/slott56/unlearning-sql repository.
3. Change to the downloaded directory.
.. code-block:: bash
cd unlearning-sql
3. Install required packages to run the demo applications.
.. code-block:: bash
python -m pip install -r requirements.txt
4. Install the packages to do unit testing.
.. code-block:: bash
python -m pip install -r requirements-test.txt
Upgrades
--------To get **all** the latest and greatest versions of package, use pip-tools.
.. code-block:: bash
pip-compile --upgrade
pip-compile --upgrade requirements-test.inpython -m pip install --upgrade -r requirements.txt
python -m pip install --upgrade -r requirements-test.txtGeneral Operation
=================In order to play with the examples, it's helpful
to have a file named ``activate_source.csv``.
This file contains the raw data to be bulk-loaded
into the database.It's also helpful, of course, to have a database.
In this case, it will be ``unlearning_sql.db``.To build the file, and the database, execute
the following two steps:.. code-block:: bash
python src/fake_data.py
python src/sql_db_preparation.pyThe ``fake_data.py`` program builds the ``activate_source.data`` file.
The ``sql_db_preparation.py`` program loads the database with some (but not all) of the fake data.
This omission of data permits some of the data validation rules to spot
bad data in the input.Makefile
=========The ``Makefile`` has targets to help create files and databases.
.. code-block:: bash
make sql_load
The ``sql_load`` target will build the fake data and populate the database if needed.
It will run the SQL-based loader application... code-block:: bash
make python_load
The ``python_load`` target will build the fake data and populate the database if needed.
It will run the Python-based loader application.Diagrams
========The diagrams were built with PlantUML. See https://plantuml.com for more information.
This is not required to run the demonstration applications.
It's handy for creating entity-relationship diagrams.