Skip to content

Commit

Permalink
[DOC] Update README (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
PabloRMira authored Dec 21, 2020
1 parent 95c5d42 commit 1544b22
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ repos:

To exemplify the formatting let's say you have a SQL query like this

```
```python
example_sql = """
create or replace table mytable as -- mytable example
seLecT a.asdf, b.qwer, -- some comment here
Expand All @@ -67,7 +67,7 @@ groUp by a.asdf

Then you can use this package to format it so that it is better readable

```
```python
from sql_formatter.core import format_sql
print(format_sql(example_sql))
```
Expand All @@ -91,7 +91,7 @@ print(format_sql(example_sql))

It can even deal with subqueries and it will correct my favourite simple careless mistake (comma at the end of SELECT statement before of FROM) for you on the flow :-)

```
```python
print(format_sql("""
select asdf, cast(qwer as numeric), -- some comment
qwer1
Expand Down Expand Up @@ -121,7 +121,7 @@ where qwer1 >= 0

The formatter is also robust against nested subqueries

```
```python
print(format_sql("""
select field1, field2 from (select field1,
field2 from (select field1, field2,
Expand All @@ -143,7 +143,7 @@ field3 from table1 where a=1 and b>=100))

If you do not want to get some query formatted in your SQL file then you can use the marker `/*skip-formatter*/` in your query to disable formatting for just the corresponding query

```
```python
from sql_formatter.format_file import format_sql_commands
print(format_sql_commands(
"""
Expand Down Expand Up @@ -223,6 +223,7 @@ To setup the development environment:
2. Install our conda development environment running `conda env create -f environment.yml`
3. Activate the python environment using `conda activate sql-formatter-dev`
4. Run `nbdev_install_git_hooks`
5. Run `pip install -e .` to install the package in editable mode. This way the command line interface (CLI) `sql-formatter` will incorporate your changes in the python code

#### Development Workflow

Expand Down
1 change: 1 addition & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ <h4 id="Setup-the-development-environment">Setup the development environment<a c
<li>Install our conda development environment running <code>conda env create -f environment.yml</code></li>
<li>Activate the python environment using <code>conda activate sql-formatter-dev</code></li>
<li>Run <code>nbdev_install_git_hooks</code></li>
<li>Run <code>pip install -e .</code> to install the package in editable mode. This way the command line interface (CLI) <code>sql-formatter</code> will incorporate your changes in the python code</li>
</ol>
<h4 id="Development-Workflow">Development Workflow<a class="anchor-link" href="#Development-Workflow"> </a></h4><p>For development we follow these steps:</p>
<ol>
Expand Down

0 comments on commit 1544b22

Please sign in to comment.