Skip to main content

Sql Parser and Validator

Project description

sqlcarve

PyPI License: MIT

SQL Parser for Teachers

SQL Validation and execution

fichier.sql est le fichier à valider. ref_stmnt est la requête de référence pour la validation sémantique. referencefile.json est le modèle de commentaire pour la validation des commentaires.

Exemple de referencefile.json

{
  "profcomments": {
    "auteur": "",
    "objectif": "",
    "documentation": ""
  },
  "studentcomments": {
    "author": "",
    "cip": "",
    "objectif": ""
  }
}

Exemple d'utilisation

from src.sqlcarve.validator.validator import *

valid = Validator()
report = {}
with open("fichier.sql", "r") as f_content:
    statement_list = Preprocessor.extract_stmnts(f_content)

    for stmnt in statement_list:
        report = valid.validate(statement=stmnt, ref_statement=ref_stmnt, ref_comments="referencefile.json", type="all")

print(report)

Résultat

    {'commentaires': [], 'syntax': 'Validation syntaxique réussie', 'semantique': 'Validation sémantique réussie'}

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

Sqlcarve-0.4.31.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

Sqlcarve-0.4.31-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file Sqlcarve-0.4.31.tar.gz.

File metadata

  • Download URL: Sqlcarve-0.4.31.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.0

File hashes

Hashes for Sqlcarve-0.4.31.tar.gz
Algorithm Hash digest
SHA256 57f97b887cbff96905419ccd0b50f329550bc5a114e97618e60aa0526faef9f7
MD5 c35e3a6cfec14fb8d1d45b6809445387
BLAKE2b-256 273fae586f3f20f6eeb39ad809dd3c52b1653e090c2d89d09232305566c8dc40

See more details on using hashes here.

File details

Details for the file Sqlcarve-0.4.31-py3-none-any.whl.

File metadata

  • Download URL: Sqlcarve-0.4.31-py3-none-any.whl
  • Upload date:
  • Size: 16.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.0

File hashes

Hashes for Sqlcarve-0.4.31-py3-none-any.whl
Algorithm Hash digest
SHA256 4d542f3fc34346c3bc66d0bd934fded4b914166852063cadd3a5e0cd0baee4d4
MD5 14ada5f3f94cc6891b113153d06025f1
BLAKE2b-256 8eef0c964fc3e80290d1c6473930184079ea580b3e2414b080ebf08e5711a041

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