Skip to content

Commit a967401

Browse files
authored
no longer show slack link in error messages (#1051)
* errro messages * lint * tests * f
1 parent be68765 commit a967401

File tree

12 files changed

+6
-41
lines changed

12 files changed

+6
-41
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## 0.11.1dev
44

5+
* [Fix] No longer showing the Slack link in error messages
6+
57
## 0.11.0 (2025-03-03)
68

79
* [API Change] Disabled `%sql` and `%%sql` on Databricks ([#1047](https://github.com/ploomber/jupysql/issues/1047))

src/sql/connection/connection.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
from IPython.core.error import UsageError
2323
import sqlglot
2424
import sqlparse
25-
from ploomber_core.exceptions import modify_exceptions
2625

2726

2827
from sql.store import store
@@ -951,7 +950,6 @@ def close(self):
951950
self._connection.engine.dispose()
952951

953952
@classmethod
954-
@modify_exceptions
955953
def _start_sqlalchemy_connection(cls, engine, connect_str):
956954
try:
957955
connection = engine.connect()

src/sql/exceptions.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ def exception_factory(name):
1818
def _error(message):
1919
exc = error.UsageError(message)
2020
exc.error_type = name
21-
# this attribute will allow the @modify_exceptions decorator to add the
22-
# community link
23-
exc.modify_exception = True
2421
return exc
2522

2623
return _error

src/sql/inspect.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from sqlalchemy import inspect
22
from prettytable import PrettyTable
3-
from ploomber_core.exceptions import modify_exceptions
43
from sql.connection import ConnectionManager
54
from sql import exceptions
65
import math
@@ -165,7 +164,6 @@ def _assign_column_specific_stats(col_stats, is_numeric):
165164
return col_stats
166165

167166

168-
@modify_exceptions
169167
class Columns(DatabaseInspection):
170168
"""
171169
Represents the columns in a database table
@@ -195,7 +193,6 @@ def __init__(self, name, schema, conn=None) -> None:
195193
self._table_txt = self._table.get_string()
196194

197195

198-
@modify_exceptions
199196
class TableDescription(DatabaseInspection):
200197
"""
201198
Generates descriptive statistics.

src/sql/magic.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from ipywidgets import interact
1010
except ModuleNotFoundError:
1111
interact = None
12-
from ploomber_core.exceptions import modify_exceptions
1312
from IPython.core.magic import (
1413
Magics,
1514
cell_magic,
@@ -367,7 +366,6 @@ def execute(self, line="", cell="", local_ns=None):
367366
line=line, cell=cell, local_ns=local_ns, is_interactive_mode=False
368367
)
369368

370-
@modify_exceptions
371369
def _execute(self, line, cell, local_ns, is_interactive_mode=False):
372370
"""
373371
This function implements the cell logic; we create this private
@@ -626,7 +624,6 @@ def interactive_execute_wrapper(**kwargs):
626624

627625
legal_sql_identifier = re.compile(r"^[A-Za-z0-9#_$]+")
628626

629-
@modify_exceptions
630627
def _persist_dataframe(
631628
self, raw, conn, user_ns, append=False, index=True, replace=False
632629
):

src/sql/magic_plot.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from IPython.core.magic import Magics, line_magic, magics_class, no_var_expand
22
from IPython.core.magic_arguments import argument, magic_arguments
3-
from ploomber_core.exceptions import modify_exceptions
43

54
try:
65
from traitlets.config.configurable import Configurable
@@ -76,7 +75,6 @@ class SqlPlotMagic(Magics, Configurable):
7675
type=float,
7776
help="Histogram binwidth",
7877
)
79-
@modify_exceptions
8078
def execute(self, line="", cell="", local_ns=None):
8179
"""
8280
Plot magic

src/sql/plot.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"""
44

55
from ploomber_core.dependencies import requires
6-
from ploomber_core.exceptions import modify_exceptions
76
from jinja2 import Template
87

98
from sql import exceptions, display
@@ -106,7 +105,6 @@ def _between(conn, table, column, whislo, whishi, with_=None):
106105

107106

108107
# https://github.com/matplotlib/matplotlib/blob/b5ac96a8980fdb9e59c9fb649e0714d776e26701/lib/matplotlib/cbook/__init__.py
109-
@modify_exceptions
110108
def _boxplot_stats(conn, table, column, whis=1.5, autorange=False, with_=None):
111109
"""Compute statistics required to create a boxplot"""
112110
if not conn:
@@ -549,7 +547,6 @@ def histogram(
549547
return ax
550548

551549

552-
@modify_exceptions
553550
def _histogram(
554551
table, column, bins, with_=None, conn=None, facet=None, breaks=None, binwidth=None
555552
):
@@ -688,7 +685,6 @@ def _histogram(
688685
return bin_, height, bin_size
689686

690687

691-
@modify_exceptions
692688
def _histogram_stacked(
693689
table,
694690
column,
@@ -765,7 +761,6 @@ def _histogram_stacked(
765761
return data
766762

767763

768-
@modify_exceptions
769764
def _filter_aggregate(*filter_queries):
770765
"""Return a single filter query based on multiple queries.
771766
@@ -797,7 +792,6 @@ def _filter_aggregate(*filter_queries):
797792
return final_filter
798793

799794

800-
@modify_exceptions
801795
def _bar(table, column, with_=None, conn=None):
802796
"""get x and height for bar plot"""
803797
if not conn:
@@ -985,7 +979,6 @@ def bar(
985979
return ax
986980

987981

988-
@modify_exceptions
989982
def _pie(table, column, with_=None, conn=None):
990983
"""get x and height for pie chart"""
991984
if not conn:

src/sql/store.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from typing import Iterator, Iterable
33
from collections.abc import MutableMapping
44
from jinja2 import Template
5-
from ploomber_core.exceptions import modify_exceptions
65
import sql.connection
76
import difflib
87

@@ -80,7 +79,6 @@ def infer_dependencies(self, query, key):
8079
dependencies.append(table)
8180
return dependencies
8281

83-
@modify_exceptions
8482
def store(self, key, query, with_=None):
8583
if "-" in key:
8684
raise exceptions.UsageError(

src/tests/test_magic.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,8 @@
2929

3030
from conftest import runsql
3131
from sql.connection import PLOOMBER_DOCS_LINK_STR
32-
from ploomber_core.exceptions import COMMUNITY
3332
import psutil
3433

35-
COMMUNITY = COMMUNITY.strip()
3634

3735
DISPLAYLIMIT_LINK = (
3836
'<a href="https://jupysql.ploomber.io/en/'
@@ -1163,7 +1161,6 @@ def test_autolimit(ip):
11631161
Set the environment variable $DATABASE_URL
11641162
11651163
For more details, see: {PLOOMBER_DOCS_LINK_STR}
1166-
{COMMUNITY}
11671164
"""
11681165

11691166

@@ -1181,7 +1178,6 @@ def test_error_on_invalid_connection_string(ip_empty, clean_conns):
11811178
Ref: https://docs.sqlalchemy.org/en/20/core/engines.html#database-urls
11821179
11831180
For more details, see: {PLOOMBER_DOCS_LINK_STR}
1184-
{COMMUNITY}
11851181
""" # noqa
11861182

11871183

@@ -1207,7 +1203,6 @@ def test_error_on_invalid_connection_string_with_existing_conns(ip_empty, clean_
12071203
Perhaps you meant to use driver the dialect: "sqlite"
12081204
12091205
For more details, see: {PLOOMBER_DOCS_LINK_STR}
1210-
{COMMUNITY}
12111206
""" # noqa
12121207

12131208

@@ -1235,7 +1230,6 @@ def test_error_on_invalid_connection_string_with_possible_typo(ip_empty, clean_c
12351230
Example: %sql postgresql://username:password@hostname/dbname
12361231
12371232
For more details, see: {PLOOMBER_DOCS_LINK_STR}
1238-
{COMMUNITY}
12391233
""" # noqa
12401234

12411235

src/tests/test_magic_cmd.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,23 @@ def ip_snippets(ip):
3838
ip.run_cell("%sql sqlite://")
3939
ip.run_cell(
4040
"""
41-
%%sql --save high_price --no-execute
41+
%%sql --save high_price --no-execute
4242
SELECT *
4343
FROM "test_store"
4444
WHERE price >= 1.50
4545
"""
4646
)
4747
ip.run_cell(
4848
"""
49-
%%sql --save high_price_a --no-execute
49+
%%sql --save high_price_a --no-execute
5050
SELECT *
5151
FROM "high_price"
5252
WHERE symbol == 'a'
5353
"""
5454
)
5555
ip.run_cell(
5656
"""
57-
%%sql --save high_price_b --no-execute
57+
%%sql --save high_price_b --no-execute
5858
SELECT *
5959
FROM "high_price"
6060
WHERE symbol == 'b'
@@ -986,7 +986,7 @@ def test_force_delete_all_with_variable_substitution(ip_snippets):
986986
def test_force_delete_all_child_query(ip_snippets, arg):
987987
ip_snippets.run_cell(
988988
"""
989-
%%sql --save high_price_b_child --no-execute
989+
%%sql --save high_price_b_child --no-execute
990990
SELECT *
991991
FROM "high_price_b"
992992
WHERE symbol == 'b'

0 commit comments

Comments
 (0)