Repository: ploomber/jupysql
Pull request #1051 (2025-03-25 21:10:52)

no longer show slack link in error messages
## Describe your changes

## Issue number

Closes #X

## Checklist before requesting a review

- [ ] Performed a self-review of my code
- [ ] Formatted my code with [`pkgmt format`](https://ploomber-contributing.readthedocs.io/en/latest/contributing/submitting-pr.html#linting-formatting)
- [ ] Added [tests](https://ploomber-contributing.readthedocs.io/en/latest/contributing/submitting-pr.html#testing) (when necessary).
- [ ] Added [docstring](https://ploomber-contributing.readthedocs.io/en/latest/contributing/submitting-pr.html#documenting-changes-and-new-features) documentation and update the [changelog](https://ploomber-contributing.readthedocs.io/en/latest/contributing/submitting-pr.html#changelog) (when needed)



<!-- readthedocs-preview jupysql start -->
----
📚 Documentation preview 📚: https://jupysql--1051.org.readthedocs.build/en/1051/

<!-- readthedocs-preview jupysql end -->


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a8de5c7..fc2745f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,8 @@
 
 ## 0.11.1dev
 
+* [Fix] No longer showing the Slack link in error messages
+
 ## 0.11.0 (2025-03-03)
 
 * [API Change] Disabled `%sql` and `%%sql` on Databricks ([#1047](https://github.com/ploomber/jupysql/issues/1047))
diff --git a/src/sql/connection/connection.py b/src/sql/connection/connection.py
index 6c1c1d5..d4d47d8 100644
--- a/src/sql/connection/connection.py
+++ b/src/sql/connection/connection.py
@@ -22,7 +22,6 @@ from sql.run.sparkdataframe import handle_spark_dataframe
 from IPython.core.error import UsageError
 import sqlglot
 import sqlparse
-from ploomber_core.exceptions import modify_exceptions
 
 
 from sql.store import store
@@ -951,7 +950,6 @@ class SQLAlchemyConnection(AbstractConnection):
         self._connection.engine.dispose()
 
     @classmethod
-    @modify_exceptions
     def _start_sqlalchemy_connection(cls, engine, connect_str):
         try:
             connection = engine.connect()
diff --git a/src/sql/exceptions.py b/src/sql/exceptions.py
index 2f804da..e0a9be3 100644
--- a/src/sql/exceptions.py
+++ b/src/sql/exceptions.py
@@ -18,9 +18,6 @@ def exception_factory(name):
     def _error(message):
         exc = error.UsageError(message)
         exc.error_type = name
-        # this attribute will allow the @modify_exceptions decorator to add the
-        # community link
-        exc.modify_exception = True
         return exc
 
     return _error
diff --git a/src/sql/inspect.py b/src/sql/inspect.py
index 2506789..2150413 100644
--- a/src/sql/inspect.py
+++ b/src/sql/inspect.py
@@ -1,6 +1,5 @@
 from sqlalchemy import inspect
 from prettytable import PrettyTable
-from ploomber_core.exceptions import modify_exceptions
 from sql.connection import ConnectionManager
 from sql import exceptions
 import math
@@ -165,7 +164,6 @@ def _assign_column_specific_stats(col_stats, is_numeric):
     return col_stats
 
 
-@modify_exceptions
 class Columns(DatabaseInspection):
     """
     Represents the columns in a database table
@@ -195,7 +193,6 @@ class Columns(DatabaseInspection):
         self._table_txt = self._table.get_string()
 
 
-@modify_exceptions
 class TableDescription(DatabaseInspection):
     """
      Generates descriptive statistics.
diff --git a/src/sql/magic.py b/src/sql/magic.py
index c8e7a7e..a41ba00 100644
--- a/src/sql/magic.py
+++ b/src/sql/magic.py
@@ -9,7 +9,6 @@ try:
     from ipywidgets import interact
 except ModuleNotFoundError:
     interact = None
-from ploomber_core.exceptions import modify_exceptions
 from IPython.core.magic import (
     Magics,
     cell_magic,
@@ -367,7 +366,6 @@ class SqlMagic(Magics, Configurable):
             line=line, cell=cell, local_ns=local_ns, is_interactive_mode=False
         )
 
-    @modify_exceptions
     def _execute(self, line, cell, local_ns, is_interactive_mode=False):
         """
         This function implements the cell logic; we create this private
@@ -626,7 +624,6 @@ class SqlMagic(Magics, Configurable):
 
     legal_sql_identifier = re.compile(r"^[A-Za-z0-9#_$]+")
 
-    @modify_exceptions
     def _persist_dataframe(
         self, raw, conn, user_ns, append=False, index=True, replace=False
     ):
diff --git a/src/sql/magic_plot.py b/src/sql/magic_plot.py
index 92c1aec..a1db204 100644
--- a/src/sql/magic_plot.py
+++ b/src/sql/magic_plot.py
@@ -1,6 +1,5 @@
 from IPython.core.magic import Magics, line_magic, magics_class, no_var_expand
 from IPython.core.magic_arguments import argument, magic_arguments
-from ploomber_core.exceptions import modify_exceptions
 
 try:
     from traitlets.config.configurable import Configurable
@@ -76,7 +75,6 @@ class SqlPlotMagic(Magics, Configurable):
         type=float,
         help="Histogram binwidth",
     )
-    @modify_exceptions
     def execute(self, line="", cell="", local_ns=None):
         """
         Plot magic
diff --git a/src/sql/plot.py b/src/sql/plot.py
index 2c2e106..bdfa5d1 100644
--- a/src/sql/plot.py
+++ b/src/sql/plot.py
@@ -3,7 +3,6 @@ Plot using the SQL backend
 """
 
 from ploomber_core.dependencies import requires
-from ploomber_core.exceptions import modify_exceptions
 from jinja2 import Template
 
 from sql import exceptions, display
@@ -106,7 +105,6 @@ OR  "{{column}}" > {{whishi}}
 
 
 # https://github.com/matplotlib/matplotlib/blob/b5ac96a8980fdb9e59c9fb649e0714d776e26701/lib/matplotlib/cbook/__init__.py
-@modify_exceptions
 def _boxplot_stats(conn, table, column, whis=1.5, autorange=False, with_=None):
     """Compute statistics required to create a boxplot"""
     if not conn:
@@ -549,7 +547,6 @@ def histogram(
     return ax
 
 
-@modify_exceptions
 def _histogram(
     table, column, bins, with_=None, conn=None, facet=None, breaks=None, binwidth=None
 ):
@@ -688,7 +685,6 @@ def _histogram(
     return bin_, height, bin_size
 
 
-@modify_exceptions
 def _histogram_stacked(
     table,
     column,
@@ -765,7 +761,6 @@ def _histogram_stacked(
     return data
 
 
-@modify_exceptions
 def _filter_aggregate(*filter_queries):
     """Return a single filter query based on multiple queries.
 
@@ -797,7 +792,6 @@ def _filter_aggregate(*filter_queries):
     return final_filter
 
 
-@modify_exceptions
 def _bar(table, column, with_=None, conn=None):
     """get x and height for bar plot"""
     if not conn:
@@ -985,7 +979,6 @@ def bar(
     return ax
 
 
-@modify_exceptions
 def _pie(table, column, with_=None, conn=None):
     """get x and height for pie chart"""
     if not conn:
diff --git a/src/sql/store.py b/src/sql/store.py
index e36f99a..30baa7a 100644
--- a/src/sql/store.py
+++ b/src/sql/store.py
@@ -2,7 +2,6 @@ import sqlparse
 from typing import Iterator, Iterable
 from collections.abc import MutableMapping
 from jinja2 import Template
-from ploomber_core.exceptions import modify_exceptions
 import sql.connection
 import difflib
 
@@ -80,7 +79,6 @@ class SQLStore(MutableMapping):
                     dependencies.append(table)
         return dependencies
 
-    @modify_exceptions
     def store(self, key, query, with_=None):
         if "-" in key:
             raise exceptions.UsageError(


Test patch:
diff --git a/src/tests/test_magic.py b/src/tests/test_magic.py
index 8295441..c0ee3c3 100644
--- a/src/tests/test_magic.py
+++ b/src/tests/test_magic.py
@@ -29,10 +29,8 @@ from sql.magic import load_ipython_extension
 
 from conftest import runsql
 from sql.connection import PLOOMBER_DOCS_LINK_STR
-from ploomber_core.exceptions import COMMUNITY
 import psutil
 
-COMMUNITY = COMMUNITY.strip()
 
 DISPLAYLIMIT_LINK = (
     '<a href="https://jupysql.ploomber.io/en/'
@@ -1163,7 +1161,6 @@ OR
 Set the environment variable $DATABASE_URL
 
 For more details, see: {PLOOMBER_DOCS_LINK_STR}
-{COMMUNITY}
 """
 
 
@@ -1181,7 +1178,6 @@ To fix it, make sure you are using correct driver name:
 Ref: https://docs.sqlalchemy.org/en/20/core/engines.html#database-urls
 
 For more details, see: {PLOOMBER_DOCS_LINK_STR}
-{COMMUNITY}
 """  # noqa
 
 
@@ -1207,7 +1203,6 @@ Can't load plugin: sqlalchemy.dialects:sqlit
 Perhaps you meant to use driver the dialect: "sqlite"
 
 For more details, see: {PLOOMBER_DOCS_LINK_STR}
-{COMMUNITY}
 """  # noqa
 
 
@@ -1235,7 +1230,6 @@ Pass a valid connection string:
     Example: %sql postgresql://username:password@hostname/dbname
 
 For more details, see: {PLOOMBER_DOCS_LINK_STR}
-{COMMUNITY}
 """  # noqa
 
 
diff --git a/src/tests/test_magic_cmd.py b/src/tests/test_magic_cmd.py
index c2550b3..8247051 100644
--- a/src/tests/test_magic_cmd.py
+++ b/src/tests/test_magic_cmd.py
@@ -38,7 +38,7 @@ def ip_snippets(ip):
     ip.run_cell("%sql sqlite://")
     ip.run_cell(
         """
-        %%sql --save high_price --no-execute
+%%sql --save high_price --no-execute
 SELECT *
 FROM "test_store"
 WHERE price >= 1.50
@@ -46,7 +46,7 @@ WHERE price >= 1.50
     )
     ip.run_cell(
         """
-        %%sql --save high_price_a --no-execute
+%%sql --save high_price_a --no-execute
 SELECT *
 FROM "high_price"
 WHERE symbol == 'a'
@@ -54,7 +54,7 @@ WHERE symbol == 'a'
     )
     ip.run_cell(
         """
-        %%sql --save high_price_b --no-execute
+%%sql --save high_price_b --no-execute
 SELECT *
 FROM "high_price"
 WHERE symbol == 'b'
@@ -986,7 +986,7 @@ def test_force_delete_all_with_variable_substitution(ip_snippets):
 def test_force_delete_all_child_query(ip_snippets, arg):
     ip_snippets.run_cell(
         """
-        %%sql --save high_price_b_child --no-execute
+%%sql --save high_price_b_child --no-execute
 SELECT *
 FROM "high_price_b"
 WHERE symbol == 'b'
diff --git a/src/tests/test_magic_plot.py b/src/tests/test_magic_plot.py
index ab21781..0ebafba 100644
--- a/src/tests/test_magic_plot.py
+++ b/src/tests/test_magic_plot.py
@@ -780,7 +780,6 @@ def test_sqlplot_snippet_deletion(ip_snippets, arg):
 TABLE_NAME_TYPO_MSG = """
 There is no table with name 'subst' in the default schema
 Did you mean: 'subset'
-If you need help solving this issue, send us a message: https://ploomber.io/community
 """
 
 
@@ -793,7 +792,6 @@ def test_sqlplot_snippet_typo(ip_snippets):
 
 MISSING_TABLE_ERROR_MSG = """
 There is no table with name 'missing' in the default schema
-If you need help solving this issue, send us a message: https://ploomber.io/community
 """
 
 
diff --git a/src/tests/test_syntax_errors.py b/src/tests/test_syntax_errors.py
index d402154..0bf0dfe 100644
--- a/src/tests/test_syntax_errors.py
+++ b/src/tests/test_syntax_errors.py
@@ -5,10 +5,6 @@ from sqlalchemy.exc import OperationalError
 from IPython.core.error import UsageError
 
 from sql.error_handler import ORIGINAL_ERROR, CTE_MSG
-from ploomber_core.exceptions import COMMUNITY
-
-
-COMMUNITY = COMMUNITY.strip()
 
 
 @pytest.fixture
@@ -39,7 +35,6 @@ def query_multiple():
 def _common_strings_check(err):
     assert ORIGINAL_ERROR.strip() in str(err.value)
     assert CTE_MSG.strip() in str(err.value)
-    assert COMMUNITY in str(err.value)
     assert isinstance(err.value, UsageError)
 
 
@@ -51,7 +46,6 @@ def test_syntax_error_incorrect_column_name(ip, query_incorrect_column_name):
 
 message_incorrect_column_name_long = f"""\
 (sqlite3.OperationalError) near "FROM": syntax error
-{COMMUNITY}
 [SQL: SELECT first_(name FROM author;]
 """  # noqa
 
@@ -75,7 +69,6 @@ def test_syntax_error_multiple_statements(ip, query_multiple):
 
 message_multiple_statements_long = f"""\
 (sqlite3.OperationalError) near ";": syntax error
-{COMMUNITY}
 [SQL: ALTER TABLE author RENAME another_name;]
 """  # noqa