Repository: ploomber/jupysql (python)

Issue:
Using jupysql magic %sql in databricks
I have been using the sql magic `%sql` using jupysql module a lot in my local computer. 
Nowadays, I am starting to use the databricks and porting all my jupyter notebooks to databricks.

The databricks already have their implementation of `%sql` and thus, this magic from jupySQL may not work.

Is there any way if can use both `%sql` from databricks and from jupysql?

Such as can use some alias of `%sql` such as `%sqljupy`?

Pull request description:
adding `%jupysql`/`%%jupysql` as alias
closes #102

<!-- readthedocs-preview jupysql start -->
----
:books: Documentation preview :books:: https://jupysql--112.org.readthedocs.build/en/112/

<!-- readthedocs-preview jupysql end -->

Patch:
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
new file mode 100644
index 0000000..31cf702
--- /dev/null
+++ b/.github/pull_request_template.md
@@ -0,0 +1,11 @@
+## Describe your changes
+
+## Issue ticket number and link
+Closes #x
+
+## Checklist before requesting a review
+
+- [ ] I have performed a self-review of my code
+- [ ] I have added thorough [tests](https://github.com/ploomber/contributing/blob/main/CONTRIBUTING.md#testing) (when necessary).
+- [ ] I have added the right documentation in the [docstring](https://github.com/ploomber/contributing/blob/main/CONTRIBUTING.md#documenting-changes-and-new-features) and [changelog](https://github.com/ploomber/contributing/blob/main/CONTRIBUTING.md#changelog) (when needed)
+
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e44fe7d..e150ccf 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@
 * [Feature] Adds `%sqlcmd tables` ([#76](https://github.com/ploomber/jupysql/issues/76))
 * [Feature] Adds `%sqlcmd columns` ([#76](https://github.com/ploomber/jupysql/issues/76))
 * [Fix] `setup.py` fix due to change in setuptools 67.0.0
+* [Feature] Adds `%jupysql`/`%%jupysql` as alias for `%sql`/`%%sql`
 
 ## 0.5.2 (2023-01-03)
 
diff --git a/doc/howto.md b/doc/howto.md
index a09e28a..4df9840 100644
--- a/doc/howto.md
+++ b/doc/howto.md
@@ -11,6 +11,19 @@ kernelspec:
   name: python3
 ---
 
+```{code-cell} ipython3
+:tags: [remove-cell]
+
+# clean up all .db files (this cell will not be displayed in the docs)
+from pathlib import Path
+from glob import glob
+
+for file in (Path(f) for f in glob("*.db")):
+    if file.exists():
+        print(f"Deleting: {file}")
+        file.unlink()
+```
+
 # How-To
 
 ## Query CSV files with SQL
@@ -230,3 +243,36 @@ Close by passing the alias:
 ```{code-cell} ipython3
 %sql -l
 ```
+
+## Connect to existing `engine`
+
+Pass the name of the engine:
+
+```{code-cell} ipython3
+some_engine = create_engine("sqlite:///some.db")
+```
+
+```{code-cell} ipython3
+%sql some_engine
+```
+
++++ {"tags": []}
+
+## Use `%sql`/`%%sql` in Databricks
+
+Databricks uses the same name (`%sql`/`%%sql`) for its SQL magics; however, JupySQL exposes a `%jupysql`/`%%jupysql` alias so you can use both:
+
+```{code-cell} ipython3
+%jupysql duckdb://
+```
+
+```{code-cell} ipython3
+%jupysql SELECT * FROM "penguins.csv" LIMIT 3
+```
+
+```{code-cell} ipython3
+%%jupysql
+SELECT *
+FROM "penguins.csv"
+LIMIT 3
+```
diff --git a/src/sql/magic.py b/src/sql/magic.py
index 93ad922..8b26463 100644
--- a/src/sql/magic.py
+++ b/src/sql/magic.py
@@ -126,6 +126,8 @@ class SqlMagic(Magics, Configurable):
     @needs_local_scope
     @line_magic("sql")
     @cell_magic("sql")
+    @line_magic("jupysql")
+    @cell_magic("jupysql")
     @magic_arguments()
     @argument("line", default="", nargs="*", type=str, help="sql")
     @argument(


Test patch:
diff --git a/src/tests/test_magic.py b/src/tests/test_magic.py
index 6a8e27f..f86059a 100644
--- a/src/tests/test_magic.py
+++ b/src/tests/test_magic.py
@@ -9,6 +9,7 @@ import pytest
 from sqlalchemy import create_engine
 
 from sql.connection import Connection
+from sql.magic import SqlMagic
 from conftest import runsql
 
 
@@ -460,3 +461,10 @@ def test_autolimit(ip):
     ip.run_line_magic("config", "SqlMagic.autolimit = 1")
     result = runsql(ip, "SELECT * FROM test;")
     assert len(result) == 1
+
+
+def test_jupysql_alias():
+    assert SqlMagic.magics == {
+        "line": {"jupysql": "execute", "sql": "execute"},
+        "cell": {"jupysql": "execute", "sql": "execute"},
+    }