Skip to main content

SQL editor support for formatting, syntax highlighting and code completion of SQL in cell magic, line magic, python string and file editor.

Project description

jupyterlab-sql-editor

A JupyterLab extension providing:

  • SQL formatter
  • Automatic extraction of database schemas
  • Auto-completion triggered by tab or dot for:
    • table names
    • table aliases
    • table joins
    • nested column names
    • functions
  • Syntax highlighting for:
    • line magic
    • cell magic
    • Python strings

IPython magic for:

  • Spark SQL
  • Trino

Une extension à JupyterLab qui contribue:

  • Formattage de SQL
  • Extraction automatique du schéma de base de données
  • Complétion automatique suivant un tab ou dot des:
    • noms de tables
    • alias de tables
    • jointures de tables
    • noms de colones imbriquées
    • fonctions
  • Surbrillance de la syntaxe:
    • ligne magic
    • cellule magic
    • chaînes de caractères Python

IPython magic pour:

  • Spark SQL
  • Trino

Execute and output your query results into an interactive data grid / Execution et affichage des résultats dans une grille interactive

Output as JSON / Résultats en JSON

Auto suggest column names and sub-fields / Suggestion automatique des noms de colones et sous champs

Auto suggest JOINs on matching column names / Suggestion automatique de jointures sur nom de colones

Format and show syntax highlighting in Notebook code cells / Formattage et surbrillance de la syntaxe des cellules

Works in Python strings / Fonctionne à l'intérieur d'une chaînes de caractères Python

Capture your Spark query as a Dataframe or a temporary view / Capture de la requête dans un Dataframe ou vue temporaire

Use jinja templating to create re-usable SQL / Utilisation de Jinja pour création de requêtes SQL réutilisables

Installation

Follow the installation instructions in CONTRIBUTING

Suivre les instructions d'installation dans CONTRIBUTING

Parameters / Paramètres

Parameter usage example:

%%sparksql -c -l 10 --dataframe df
<QUERY>

sparksql

Parameter Description
--database NAME Spark database to use.
-l LIMIT --limit LIMIT The maximum number of rows to display. A value of zero is equivalent to --output skip
-r all|local|none --refresh all|local|none Force the regeneration of the schema cache file. The local option will only update tables/views created in the local Spark context.
-d NAME --dataframe NAME Capture dataframe in a local variable named NAME.
-c --cache Cache dataframe.
-e --eager Cache dataframe with eager load.
-v VIEW --view VIEW Create or replace a temporary view named VIEW.
-o sql|json|html|grid|text|schema|skip|none --output sql|json|html|grid|text|schema|skip|none Output format. Defaults to html. The sql option prints the SQL statement that will be executed (useful to test jinja templated statements).
-s --show-nonprinting Replace none printable characters with their ascii codes (LF -> \x0a)
-j --jinja Enable Jinja templating support.
-b --dbt Enable DBT templating support.
-t LIMIT --truncate LIMIT Truncate output.
-m update|complete --streaming_mode update|complete The mode of streaming queries.
-x --lean-exceptions Shortened exceptions. Might be helpful if the exceptions reported by Spark are noisy such as with big SQL queries.

trino

Parameter Description
-c NAME --catalog NAME Trino catalog to use.
-s NAME --schema NAME Trino schema to use.
-l LIMIT --limit LIMIT The maximum number of rows to display. A value of zero is equivalent to --output skip
-r all|none --refresh all|none Force the regeneration of the schema cache file.
-d NAME --dataframe NAME Capture dataframe in a local variable named NAME.
-o sql|json|html|grid|text|schema|skip|none --output sql|json|html|grid|text|schema|skip|none Output format. Defaults to html. The sql option prints the SQL statement that will be executed (useful to test jinja templated statements).
-s --show-nonprinting Replace none printable characters with their ascii codes (LF -> \x0a).
-j --jinja Enable Jinja templating support.
-t LIMIT --truncate LIMIT Truncate output.
-x STATEMENT --raw STATEMENT Run statement as is. Do not wrap statement with a limit. Use this option to run statement which can't be wrapped in a SELECT/LIMIT statement. For example EXPLAIN, SHOW TABLE, SHOW CATALOGS.

Security Vulnerability Reporting

If you believe you have identified a security vulnerability in this project, please send an email to the project team at contact@cyber.gc.ca, detailing the suspected issue and any methods you've found to reproduce it.

Please do NOT open an issue in the GitHub repository, as we'd prefer to keep vulnerability reports private until we've had an opportunity to review and address them.

Rapports sur les vulnérabilités de sécurité

Si vous pensez avoir identifié une faille de sécurité dans ce projet, veuillez envoyer un courriel à l'équipe du projet à contact@cyber.gc.ca, en détaillant le problème soupçonné et les méthodes que vous avez trouvées pour le reproduire.

Veuillez NE PAS ouvrir un problème dans le GitHub repo, car nous préférerons garder les rapports de vulnérabilités privés jusqu'à ce que nous ayons eu l'occasion de les examiner et de les résoudre.

Shout-outs / Remerciements

Many thanks to the contributors of these projects / Merci à tous les contributeurs des projets suivants:

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

jupyterlab_sql_editor-0.1.63.tar.gz (386.1 kB view details)

Uploaded Source

Built Distribution

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

jupyterlab_sql_editor-0.1.63-py3-none-any.whl (521.0 kB view details)

Uploaded Python 3

File details

Details for the file jupyterlab_sql_editor-0.1.63.tar.gz.

File metadata

  • Download URL: jupyterlab_sql_editor-0.1.63.tar.gz
  • Upload date:
  • Size: 386.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for jupyterlab_sql_editor-0.1.63.tar.gz
Algorithm Hash digest
SHA256 9e0f704834f64b5103bd71affb5862f598b69def506d9172af7581773f6923ae
MD5 574ec1aa9170c62eecc846515dce8e04
BLAKE2b-256 0f41c7e6c36e4bca625772156981979146912f94c294a9eb48d07c250d9b9e21

See more details on using hashes here.

File details

Details for the file jupyterlab_sql_editor-0.1.63-py3-none-any.whl.

File metadata

File hashes

Hashes for jupyterlab_sql_editor-0.1.63-py3-none-any.whl
Algorithm Hash digest
SHA256 bb8fa62092f3191b2826d15105eb4f5d82925608d2332e9eeb8424b675bb6d7b
MD5 b87856c841e46b4bfc6cae866a4ec7b8
BLAKE2b-256 7a54ac91a3e857f4ef9ae4b3269346e3c71bde6f6ff739c4238d7ff383402293

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