diff --git a/CHANGELOG.md b/CHANGELOG.md index a8de5c78a..fc2745f23 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 6c1c1d525..d4d47d8aa 100644 --- a/src/sql/connection/connection.py +++ b/src/sql/connection/connection.py @@ -22,7 +22,6 @@ 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 @@ def close(self): 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 2f804dad2..e0a9be351 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 250678930..2150413d7 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 @@ def __init__(self, name, schema, conn=None) -> None: 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 c8e7a7eb5..a41ba00f1 100644 --- a/src/sql/magic.py +++ b/src/sql/magic.py @@ -9,7 +9,6 @@ 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 @@ def execute(self, line="", cell="", local_ns=None): 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 @@ def interactive_execute_wrapper(**kwargs): 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 92c1aecad..a1db2049e 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 2c2e106c1..bdfa5d1d1 100644 --- a/src/sql/plot.py +++ b/src/sql/plot.py @@ -3,7 +3,6 @@ """ 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 @@ def _between(conn, table, column, whislo, whishi, with_=None): # 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 e36f99a19..30baa7af2 100644 --- a/src/sql/store.py +++ b/src/sql/store.py @@ -2,7 +2,6 @@ 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 @@ def infer_dependencies(self, query, key): dependencies.append(table) return dependencies - @modify_exceptions def store(self, key, query, with_=None): if "-" in key: raise exceptions.UsageError( diff --git a/src/tests/test_magic.py b/src/tests/test_magic.py index 8295441a4..c0ee3c357 100644 --- a/src/tests/test_magic.py +++ b/src/tests/test_magic.py @@ -29,10 +29,8 @@ 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 = ( '= 1.50 @@ -46,7 +46,7 @@ def ip_snippets(ip): ) 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 @@ def ip_snippets(ip): ) 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 ab2178172..0ebafba69 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 d4021543d..0bf0dfe6c 100644 --- a/src/tests/test_syntax_errors.py +++ b/src/tests/test_syntax_errors.py @@ -5,10 +5,6 @@ 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