-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] Variable names ending with
and
get split in WHERE statements (#…
…165)
- Loading branch information
1 parent
fdb177e
commit a5f5c5f
Showing
8 changed files
with
282 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
--- | ||
|
||
title: Additional tests | ||
|
||
|
||
keywords: fastai | ||
sidebar: home_sidebar | ||
|
||
|
||
|
||
nb_path: "nbs/99_additional_tests.ipynb" | ||
--- | ||
<!-- | ||
################################################# | ||
### THIS FILE WAS AUTOGENERATED! DO NOT EDIT! ### | ||
################################################# | ||
# file to edit: nbs/99_additional_tests.ipynb | ||
# command to build the docs after a change: nbdev_build_docs | ||
--> | ||
|
||
<div class="container" id="notebook-container"> | ||
|
||
{% raw %} | ||
|
||
<div class="cell border-box-sizing code_cell rendered"> | ||
|
||
</div> | ||
{% endraw %} | ||
|
||
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell"> | ||
<div class="text_cell_render border-box-sizing rendered_html"> | ||
<h2 id="core">core<a class="anchor-link" href="#core"> </a></h2> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell"> | ||
<div class="text_cell_render border-box-sizing rendered_html"> | ||
<h3 id="format_where">format_where<a class="anchor-link" href="#format_where"> </a></h3> | ||
</div> | ||
</div> | ||
</div> | ||
{% raw %} | ||
|
||
<div class="cell border-box-sizing code_cell rendered"> | ||
<div class="input"> | ||
|
||
<div class="inner_cell"> | ||
<div class="input_area"> | ||
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">assert_and_print</span><span class="p">(</span> | ||
<span class="n">format_where</span><span class="p">(</span> | ||
<span class="s2">"WHERE brand = 'my_brand'"</span> | ||
<span class="p">),</span> <span class="s2">"WHERE brand = 'my_brand'"</span> | ||
<span class="p">)</span> | ||
</pre></div> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="output_wrapper"> | ||
<div class="output"> | ||
|
||
<div class="output_area"> | ||
|
||
<div class="output_subarea output_stream output_stdout output_text"> | ||
<pre>WHERE brand = 'my_brand' | ||
</pre> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
|
||
</div> | ||
{% endraw %} | ||
|
||
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell"> | ||
<div class="text_cell_render border-box-sizing rendered_html"> | ||
<h3 id="format_sql">format_sql<a class="anchor-link" href="#format_sql"> </a></h3> | ||
</div> | ||
</div> | ||
</div> | ||
{% raw %} | ||
|
||
<div class="cell border-box-sizing code_cell rendered"> | ||
<div class="input"> | ||
|
||
<div class="inner_cell"> | ||
<div class="input_area"> | ||
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">assert_and_print</span><span class="p">(</span> | ||
<span class="n">format_sql</span><span class="p">(</span><span class="s2">"SELECT brand FROM table WHERE brand = 'my_brand'"</span><span class="p">),</span> | ||
<span class="sd">"""</span> | ||
<span class="sd">SELECT brand</span> | ||
<span class="sd">FROM table</span> | ||
<span class="sd">WHERE brand = 'my_brand'</span> | ||
<span class="sd">"""</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> | ||
<span class="p">)</span> | ||
</pre></div> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="output_wrapper"> | ||
<div class="output"> | ||
|
||
<div class="output_area"> | ||
|
||
<div class="output_subarea output_stream output_stdout output_text"> | ||
<pre>SELECT brand | ||
FROM table | ||
WHERE brand = 'my_brand' | ||
</pre> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
|
||
</div> | ||
{% endraw %} | ||
|
||
</div> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"#hide\n", | ||
"%load_ext autoreload\n", | ||
"%autoreload 2\n", | ||
"%config Completer.use_jedi = False # workaround for buggy jedi" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Additional tests" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"#hide\n", | ||
"from nbdev.showdoc import *\n", | ||
"from sql_formatter.utils import *\n", | ||
"from sql_formatter.core import *" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## core" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### format_where" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"WHERE brand = 'my_brand'\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"assert_and_print(\n", | ||
" format_where(\n", | ||
" \"WHERE brand = 'my_brand'\"\n", | ||
" ), \"WHERE brand = 'my_brand'\"\n", | ||
")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### format_sql" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"SELECT brand\n", | ||
"FROM table\n", | ||
"WHERE brand = 'my_brand'\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"assert_and_print(\n", | ||
" format_sql(\"SELECT brand FROM table WHERE brand = 'my_brand'\"),\n", | ||
"\"\"\"\n", | ||
"SELECT brand\n", | ||
"FROM table\n", | ||
"WHERE brand = 'my_brand'\n", | ||
"\"\"\".strip()\n", | ||
")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"#hide\n", | ||
"from nbdev.export import notebook2script\n", | ||
"notebook2script()" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python [conda env:sql-formatter-dev] *", | ||
"language": "python", | ||
"name": "conda-env-sql-formatter-dev-py" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters