MCPcopy Index your code
hub / github.com/marimo-team/marimo / log_sql_error

Function log_sql_error

marimo/_sql/error_utils.py:201–228  ·  view source on GitHub ↗

Log SQL-related errors with structured metadata.

(
    logger_func: Callable[..., None],
    *,
    message: str,
    exception: BaseException,
    rule_code: str,
    node: ast.expr | None = None,
    sql_content: str = "",
    context: str = "",
)

Source from the content-addressed store, hash-verified

199
200
201def log_sql_error(
202 logger_func: Callable[..., None],
203 *,
204 message: str,
205 exception: BaseException,
206 rule_code: str,
207 node: ast.expr | None = None,
208 sql_content: str = "",
209 context: str = "",
210) -> None:
211 """Log SQL-related errors with structured metadata."""
212 # Use centralized metadata creation
213 metadata = create_sql_error_metadata(
214 exception,
215 rule_code=rule_code,
216 node=node,
217 sql_content=sql_content,
218 context=context,
219 )
220
221 # Log clean SQL error without traces
222 log_msg = message if message else metadata["clean_message"]
223 if metadata["sql_line"] is not None and metadata["sql_col"] is not None:
224 log_msg += f" (Line {metadata['sql_line'] + 1}, Col {metadata['sql_col'] + 1})"
225 if metadata["sql_statement"]:
226 log_msg += f"\nSQL: {metadata['sql_statement']}"
227
228 logger_func(log_msg, extra=metadata)
229
230
231def create_sql_error_from_exception(

Callers 2

visit_CallMethod · 0.90
classify_sql_statementFunction · 0.90

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…