Skip to main content

Provide usefully SQL classes and functions to execute SQL queries step by step

Project description

QueryCraft

Le nom ?

Un nom en anglais qui évoque l'idée de "façonner" ou "construire" des requêtes SQL de manière intuitive, parfait pour une approche pédagogique. (GPT 4o ;-) )

Installation

git clone https://gitlab.univ-nantes.fr/ls2n-didactique/querycraft.git
cd querycraft

ou

pip install querycraft

Usage

Application qui permet de décomposer l'exécution d'une requête SQL sur une base de données PostgreSQL.

usage: pgsql-sbs [-h] [-d DB] [-u USER] [-p PASSWORD] [--host HOST] [--port PORT] [--debug] [-v] [-f FILE | -s SQL]

options:
  -h, --help            show this help message and exit
  -d DB, --db DB        database name
  -u USER, --user USER  database user
  -p PASSWORD, --password PASSWORD
                        database password
  --host HOST           database host
  --port PORT           database port
  --debug               debug mode
  -v, --verbose         verbose mode
  -f FILE, --file FILE  sql file
  -s SQL, --sql SQL     sql string

Par exemple :

pgsql-sbs -s 'select * from etudiants join notes using(noetu);'   

==================================================================================================
select * FROM  #etudiants#  JOIN notes USING (noetu) ;
┌─────────────────┬───────────────┬──────────────────┐
│ etudiants.noetu ┆ etudiants.nom ┆ etudiants.prenom │
╞═════════════════╪═══════════════╪══════════════════╡
│ 28936E          ┆ Dupont        ┆ Franck           │
│ 46283B          ┆ Dupont        ┆ Isabelle         │
│ 86719E          ┆ Martin        ┆ Adrien           │
│ 99628C          ┆ Robert        ┆ Adrien           │
│ 99321C          ┆ Denou         ┆ Michelle         │
│ 99322C          ┆ Dupont        ┆ Isabelle         │
└─────────────────┴───────────────┴──────────────────┘

==================================================================================================
select * FROM etudiants JOIN  #notes#  USING (noetu) ;
┌─────────────┬───────────────┬──────────────┬──────────────┐
│ notes.noetu ┆ notes.codemat ┆ notes.noteex ┆ notes.notecc │
╞═════════════╪═══════════════╪══════════════╪══════════════╡
│ 99628C      ┆ MIAS2I5       ┆ 12.0         ┆ 15.5         │
│ 46283B      ┆ MIAS2I5       ┆ 9.5          ┆ 2.0          │
│ 86719E      ┆ IUP2MA        ┆ 12.0         ┆ 5.5          │
│ 99321C      ┆ LIL6          ┆ 18.0         ┆ 16.5         │
│ 28936E      ┆ MIAS2I5       ┆ 13.5         ┆ 13.5         │
│ 86719E      ┆ IUP2IS        ┆ 8.5          ┆ 10.0         │
│ 99321C      ┆ LIL5          ┆ 15.0         ┆ 14.5         │
│ 99322C      ┆ MIAS2I5       ┆ 12.0         ┆ 15.5         │
│ 46283B      ┆ MIAS2I6       ┆ 8.0          ┆ 12.0         │
│ 99628C      ┆ MIAS2I6       ┆ 3.0          ┆ 7.0          │
│ 28936E      ┆ MIAS2I6       ┆ 12.0         ┆ null         │
└─────────────┴───────────────┴──────────────┴──────────────┘

==================================================================================================
select * FROM  #etudiants JOIN notes USING (noetu)#  ;
┌─────────────────┬───────────────┬──────────────────┬───────────────┬──────────────┬──────────────┐
│ etudiants.noetu ┆ etudiants.nom ┆ etudiants.prenom ┆ notes.codemat ┆ notes.noteex ┆ notes.notecc │
╞═════════════════╪═══════════════╪══════════════════╪═══════════════╪══════════════╪══════════════╡
│ 99628C          ┆ Robert        ┆ Adrien           ┆ MIAS2I5       ┆ 12.0         ┆ 15.5         │
│ 46283B          ┆ Dupont        ┆ Isabelle         ┆ MIAS2I5       ┆ 9.5          ┆ 2.0          │
│ 86719E          ┆ Martin        ┆ Adrien           ┆ IUP2MA        ┆ 12.0         ┆ 5.5          │
│ 99321C          ┆ Denou         ┆ Michelle         ┆ LIL6          ┆ 18.0         ┆ 16.5         │
│ 28936E          ┆ Dupont        ┆ Franck           ┆ MIAS2I5       ┆ 13.5         ┆ 13.5         │
│ 86719E          ┆ Martin        ┆ Adrien           ┆ IUP2IS        ┆ 8.5          ┆ 10.0         │
│ 99321C          ┆ Denou         ┆ Michelle         ┆ LIL5          ┆ 15.0         ┆ 14.5         │
│ 99322C          ┆ Dupont        ┆ Isabelle         ┆ MIAS2I5       ┆ 12.0         ┆ 15.5         │
│ 46283B          ┆ Dupont        ┆ Isabelle         ┆ MIAS2I6       ┆ 8.0          ┆ 12.0         │
│ 99628C          ┆ Robert        ┆ Adrien           ┆ MIAS2I6       ┆ 3.0          ┆ 7.0          │
│ 28936E          ┆ Dupont        ┆ Franck           ┆ MIAS2I6       ┆ 12.0         ┆ null         │
└─────────────────┴───────────────┴──────────────────┴───────────────┴──────────────┴──────────────┘

==================================================================================================
select  #* FROM etudiants JOIN notes USING (noetu)#  ;
┌─────────────────┬───────────────┬──────────────────┬───────────────┬──────────────┬──────────────┐
│ etudiants.noetu ┆ etudiants.nom ┆ etudiants.prenom ┆ notes.codemat ┆ notes.noteex ┆ notes.notecc │
╞═════════════════╪═══════════════╪══════════════════╪═══════════════╪══════════════╪══════════════╡
│ 99628C          ┆ Robert        ┆ Adrien           ┆ MIAS2I5       ┆ 12.0         ┆ 15.5         │
│ 46283B          ┆ Dupont        ┆ Isabelle         ┆ MIAS2I5       ┆ 9.5          ┆ 2.0          │
│ 86719E          ┆ Martin        ┆ Adrien           ┆ IUP2MA        ┆ 12.0         ┆ 5.5          │
│ 99321C          ┆ Denou         ┆ Michelle         ┆ LIL6          ┆ 18.0         ┆ 16.5         │
│ 28936E          ┆ Dupont        ┆ Franck           ┆ MIAS2I5       ┆ 13.5         ┆ 13.5         │
│ 86719E          ┆ Martin        ┆ Adrien           ┆ IUP2IS        ┆ 8.5          ┆ 10.0         │
│ 99321C          ┆ Denou         ┆ Michelle         ┆ LIL5          ┆ 15.0         ┆ 14.5         │
│ 99322C          ┆ Dupont        ┆ Isabelle         ┆ MIAS2I5       ┆ 12.0         ┆ 15.5         │
│ 46283B          ┆ Dupont        ┆ Isabelle         ┆ MIAS2I6       ┆ 8.0          ┆ 12.0         │
│ 99628C          ┆ Robert        ┆ Adrien           ┆ MIAS2I6       ┆ 3.0          ┆ 7.0          │
│ 28936E          ┆ Dupont        ┆ Franck           ┆ MIAS2I6       ┆ 12.0         ┆ null         │
└─────────────────┴───────────────┴──────────────────┴───────────────┴──────────────┴──────────────┘

Il est aussi possible d'utiliser MySQL :

usage: mysql-sbs [-h] [-d DB] [-u USER] [-p PASSWORD] [--host HOST] [--port PORT] [--debug] [-v] [-f FILE | -s SQL]

options:
  -h, --help            show this help message and exit
  -d DB, --db DB        database name
  -u USER, --user USER  database user
  -p PASSWORD, --password PASSWORD
                        database password
  --host HOST           database host
  --port PORT           database port
  --debug               debug mode
  -v, --verbose         verbose mode
  -f FILE, --file FILE  sql file
  -s SQL, --sql SQL     sql string

ou SQLite :

usage: sqlite-sbs [-h] [-d DB] [--debug] [-v] [-f FILE | -s SQL]

options:
  -h, --help            show this help message and exit
  -d DB, --db DB        database name
  --debug               debug mode
  -v, --verbose         verbose mode
  -f FILE, --file FILE  sql file
  -s SQL, --sql SQL     sql string

Article de recherche

Génération de la documentation

pdoc3 --html --force -o doc querycraft

Licence

(C) E. Desmontils, 2024

Ce logiciel est distribué sous licence GPLv3.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

querycraft-0.0.21.tar.gz (20.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

querycraft-0.0.21-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

Details for the file querycraft-0.0.21.tar.gz.

File metadata

  • Download URL: querycraft-0.0.21.tar.gz
  • Upload date:
  • Size: 20.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.4

File hashes

Hashes for querycraft-0.0.21.tar.gz
Algorithm Hash digest
SHA256 c63370c1a826b414d90a4512c9ef5b8f3482d9764a72269946eca05f99f129ca
MD5 1ce6d61516d783ae87f9fa6f078556c2
BLAKE2b-256 aac62c75a20dde90d7f26eb7515bef2b39aa3fe7c068c473c1802bdadf011ff7

See more details on using hashes here.

File details

Details for the file querycraft-0.0.21-py3-none-any.whl.

File metadata

  • Download URL: querycraft-0.0.21-py3-none-any.whl
  • Upload date:
  • Size: 20.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.4

File hashes

Hashes for querycraft-0.0.21-py3-none-any.whl
Algorithm Hash digest
SHA256 5f319c5efacd3c1ff514728a76f831834d6732760a202bc974649722e01bbf33
MD5 b813a780c62e54705dba2c444ede576b
BLAKE2b-256 5642f1169310285c90affe4da720fe4abedc740f1c469cb262d581e053e17534

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page