Skip to content

Commit

Permalink
tables doc
Browse files Browse the repository at this point in the history
  • Loading branch information
neelasha23 committed Jan 25, 2024
1 parent cc46c28 commit 7aafa1d
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion doc/user-guide/tables-columns.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,25 @@ Pass `--schema/-s` to get tables in a different schema:

+++

JupySQL also supports variable expansion of arguments in the form of `{{variable}}`. Let's see an example:
JupySQL also supports variable expansion of arguments in the form of `{{variable}}`. Let's see an example of parametrizing `schema`:

```{code-cell} ipython3
from sqlalchemy import create_engine
from sql.connection import SQLAlchemyConnection
conn = SQLAlchemyConnection(engine=create_engine("sqlite:///my.db"))
conn.execute("CREATE TABLE numbers (n FLOAT)")
```

```{code-cell} ipython3
schema = "schema"
```

```{code-cell} ipython3
%%sql
ATTACH DATABASE 'my.db' AS {{schema}}
```

```{code-cell} ipython3
%sqlcmd tables --schema {{schema}}
```
Expand Down

0 comments on commit 7aafa1d

Please sign in to comment.