AI Slop Code RIsk Monitor

tobymao/sqlglot

Python SQL Parser and Transpiler

11.8 Moderate pattern signal View on GitHub

Maintenance and Governance Review

This report summarizes scanner evidence for tobymao/sqlglot, a Python project with 9,673 GitHub stars. SynthScan examined 149,149 lines of code across 274 source files, recording 1268 pattern matches distributed across 15 syntactic categories. The legacy adjusted pattern signal is 11.8 (Moderate pattern signal); it is not an authorship estimate.

Use the findings to ask whether maintainers can explain intent, verify dependencies, simplify unnecessary scaffolding, and focus review effort. Risk Payload v1 adds ownership, supply-chain, over-engineering, and review-effort vectors when available. These are prompts for human verification, not probabilities, security findings, or measured maintenance costs.

11.8
Adjusted Signal
11.8
Raw Pattern Score
100%
Time Factor
2026-10-09
Last Push
9.7K
Stars
Python
Language
149.1K
Lines of Code
274
Files
1.3K
Pattern Hits
2026-10-12
Scan Date
0.46
HC Hit Rate

Risk Review · v3

Use each vector to guide manual verification of the underlying findings.

Cognitive Ownership Risk 24.7/100 · LOW

Can maintainers explain intent, assumptions, and trade-offs? 875 finding(s).

Hallucinated Dependency & Supply Chain Risk 24.8/100 · LOW

Are imports declared and package/API names verified? 365 finding(s).

Agent Over-Engineering Ratio 17.5/100 · LOW

Are wrappers, guards, and repeated structures necessary? 622 finding(s).

PR Review Velocity Impact 47.7/100 · MEDIUM

Which changes need focused human review? 1268 finding(s).

What These Metrics Mean

Adjusted Signal
Legacy pattern score normalized per 1,000 scanned lines and multiplied by the repository-level time factor. It is not an estimate of AI authorship.
Raw Pattern Score
Sum of severity- and context-weighted pattern findings before applying the time factor.
Time Factor
A coarse multiplier based on repository last-push metadata. It does not identify when individual code was written.
Pattern Hits
Count of configured pattern findings. Review each location and surrounding code before acting.
HC Hit Rate
High- and critical-severity findings per scanned file. Severity is a configured detector weight, not proof of a vulnerability or authorship.
Lines / Files
Scan coverage denominators used by the legacy normalized score.

Pattern-Signal History

This chart tracks the legacy adjusted pattern score across scan runs. Changes can reflect source changes, scan coverage, or detector/scoring versions; they do not measure AI adoption or prove that a team refactored code. Compare runs only when their scoring versions are compatible. The dashed line tracks the raw pattern-hit count.

Severity Breakdown

Groups findings by configured severity weight. Severity is not a confidence estimate, security rating, or proof that a package is missing. Verify imports against the project's manifests and inspect each finding in its local design context.

CRITICAL 2HIGH 125MEDIUM 12LOW 1129

Directory Score Breakdown

This horizontal bar chart shows where configured pattern scores accumulate across directories. Treat the bars as locations to inspect, not as evidence of authorship or code quality. Use the file-level findings to decide whether a directory needs a focused ownership, dependency, complexity, or review check.

Pattern Findings

The scanner identified 1268 distinct pattern matches across 15 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a detector match to inspect in context. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.

Reading the findings table: The Severity column indicates the configured finding weight (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — legacy comment-context matches receive a ×1.5 score weight. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier under the legacy scoring model.

Cross-Language Confusion95 hits · 570 pts
SeverityFileLineSnippetContext
HIGHsqlglot/parser.py7589 # Fast path: simple atom (column, literal, null, bool) followed by , or )COMMENT
HIGHsqlglot/parser.py3577 return self.expression(exp.ReturnsProperty(this=value, is_table=is_table, null=null))CODE
HIGHsqlglot/parser.py8524 return self.expression(exp.OnCondition(empty=empty, error=error, null=null))CODE
HIGHsqlglot/generator.py2448 null = f" NULL DEFINED AS {null}" if null else ""CODE
HIGHsqlglot/generator.py2449 return f"ROW FORMAT DELIMITED{fields}{escaped}{items}{keys}{lines}{null}"CODE
HIGHsqlglot/generator.py5845 return f"{empty}{error}{null}"CODE
HIGHsqlglot/optimizer/simplify.py1002 return falseCODE
HIGHsqlglot/optimizer/simplify.py1005 return falseCODE
HIGHsqlglot/generators/duckdb.py3467 For BINARY: Lower to: input || REPEAT(pad, GREATEST(0, target_len - OCTET_LENGTH(input)))CODE
HIGHsqlglot/generators/duckdb.py569 DuckDB's native && operator is not NULL-safe: [1,NULL,3] && [NULL,4,5] returns FALSE.STRING
HIGHsqlglot/generators/duckdb.py572 Generated SQL: (arr1 && arr2) OR (ARRAY_LENGTH(arr1) <> LIST_COUNT(arr1) AND ARRAY_LENGTH(arr2) <> LIST_COUNT(arr2))STRING
HIGHsqlglot/generators/duckdb.py2062 WHEN LENGTH(l) < 5 THEN UNHEX(PRINTF('%04X', LENGTH(l)) || h || REPEAT('00', GREATEST(0, 4 - LENGTH(l)) * 2)STRING
HIGHsqlglot/generators/duckdb.py2068 (__a, __b) -> __a || __b, ''STRING
HIGHsqlglot/generators/duckdb.py4167 this=exp.Coalesce(this=x, expressions=[null]),STRING
HIGH⚡tests/test_optimizer.py112 INSERT INTO x VALUES (null, null);STRING
HIGH⚡tests/test_optimizer.py118 INSERT INTO y VALUES (null, null);STRING
HIGH⚡tests/test_optimizer.py124 INSERT INTO y VALUES (null, null);STRING
HIGHtests/test_optimizer.py2803 "SELECT x.cola || TRIM(x.colb) AS col, DATE(x.colb), DATEFROMPARTS(y, m, d) FROM x AS x"STRING
HIGH⚡tests/test_executor.py1176 ("a || b", "xy"),CODE
HIGH⚡tests/test_executor.py1177 ("a || b || a", "xyx"),CODE
HIGH⚡tests/test_executor.py1178 ("a || n", "x1"),CODE
HIGH⚡tests/test_executor.py1179 ("n || a", "1x"),CODE
HIGH⚡tests/test_executor.py1180 ("a || nul", None),CODE
HIGH⚡tests/test_executor.py1181 ("nul || a", None),CODE
HIGH⚡tests/test_executor.py1182 ("arr || arr", [1, 2, 1, 2]),CODE
HIGH⚡tests/test_executor.py1183 ("arr || n", [1, 2, 1]),CODE
HIGH⚡tests/test_executor.py1184 ("n || arr", [1, 1, 2]),CODE
HIGH⚡tests/test_executor.py1185 ("arr || nul", None),CODE
HIGH⚡tests/test_executor.py1196 rows = execute("SELECT a || n FROM t", tables=tables, dialect="postgres").rowsCODE
HIGH⚡tests/test_executor.py1200 execute("SELECT a || n FROM t", tables=tables, dialect="trino")CODE
HIGH⚡tests/test_executor.py1448 ("ARRAY_JOIN(['hello', null ,'world'], ' ', ',')", "hello , world"),CODE
HIGH⚡tests/test_executor.py1449 ("ARRAY_JOIN(['', null ,'world'], ' ', ',')", " , world"),CODE
HIGH⚡tests/test_executor.py1450 ("STRUCT('foo', 'bar', null, null)", {"foo": "bar"}),CODE
HIGHtests/test_transforms.py131 "SELECT x, t, x || t AS z FROM y QUALIFY ROW_NUMBER() OVER (PARTITION BY x ORDER BY z DESC)",CODE
HIGHtests/test_transforms.py132 "SELECT x, t, z FROM (SELECT x, t, x || t AS z, ROW_NUMBER() OVER (PARTITION BY x ORDER BY x || t DESC) AS _CODE
HIGHtests/dialects/test_snowflake.py160 "duckdb": "SELECT (SELECT CASE WHEN l IS NULL OR LENGTH(l) = 0 THEN NULL WHEN LENGTH(l) <> LENGTH(LIST_FCODE
HIGHtests/dialects/test_snowflake.py1352 "duckdb": "SELECT (col1 && col2) OR (ARRAY_LENGTH(col1) <> LIST_COUNT(col1) AND ARRAY_LENGTH(col2) <> LICODE
HIGHtests/dialects/test_snowflake.py1378 "ARRAY_CONSTRUCT_COMPACT(1, null, 2)",CODE
HIGH⚡tests/dialects/test_bigquery.py2165 self.validate_identity("""JSON_STRIP_NULLS(PARSE_JSON('[1, null, 2, null, [null]]'))""")CODE
HIGH⚡tests/dialects/test_bigquery.py2167 """JSON_STRIP_NULLS(PARSE_JSON('[1, null, 2, null]'), include_arrays => FALSE)"""STRING
HIGH⚡tests/dialects/test_bigquery.py2170 """JSON_STRIP_NULLS(PARSE_JSON('{"a": {"b": {"c": null}}, "d": [null], "e": [], "f": 1}'), include_arrays =>STRING
HIGHtests/dialects/test_bigquery.py2782 for value in ('{"a": 1}', '[1, "a", null]', '"foo"', "1", "true", "null"):CODE
HIGHtests/dialects/test_redshift.py265 'create table if not exists city_slash_id("city/id" integer not null, state char(2) not null)',CODE
HIGHtests/dialects/test_duckdb.py341 """SELECT CASE WHEN JSON_TYPE(JSON('{"a": null}') -> '$.a') = 'NULL' THEN NULL ELSE JSON('{"a": null}') -> 'STRING
HIGHtests/dialects/test_duckdb.py343 "snowflake": """SELECT STRIP_NULL_VALUE(GET_PATH(PARSE_JSON('{"a": null}'), 'a'))""",CODE
HIGHtests/dialects/test_duckdb.py618 """SELECT '{ "family": "anatidae", "species": [ "duck", "goose", "swan", null ] }' ->> ['$.family', '$.speciSTRING
HIGHtests/dialects/test_duckdb.py629 """SELECT JSON_EXTRACT_STRING('{ "family": "anatidae", "species": [ "duck", "goose", "swan", null ] }', ['$.STRING
HIGHtests/dialects/test_duckdb.py630 """SELECT '{ "family": "anatidae", "species": [ "duck", "goose", "swan", null ] }' ->> ['$.family', '$.speciSTRING
HIGHtests/dialects/test_duckdb.py1443 self.validate_identity("a && b").assert_is(exp.ArrayOverlaps)CODE
HIGH⚡tests/dialects/test_dialect.py5116 "": """JSON_STRIP_NULLS(PARSE_JSON('[{"f1":1,"f2":null},2,null,3]'))""",CODE
HIGH⚡tests/dialects/test_dialect.py5117 "bigquery": """JSON_STRIP_NULLS(PARSE_JSON('[{"f1":1,"f2":null},2,null,3]'))""",CODE
HIGH⚡tests/dialects/test_dialect.py5120 "bigquery": """JSON_STRIP_NULLS(PARSE_JSON('[{"f1":1,"f2":null},2,null,3]'))""",CODE
HIGH⚡tests/dialects/test_dialect.py5121 "postgres": """JSON_STRIP_NULLS(CAST('[{"f1":1,"f2":null},2,null,3]' AS JSON))""",CODE
HIGHtests/dialects/test_dialect.py2316 "redshift": "a || b || c",CODE
HIGHtests/dialects/test_dialect.py2317 "sqlite": "a || b || c",CODE
HIGH⚡tests/dialects/test_dialect.py5114 """JSON_STRIP_NULLS(PARSE_JSON('[{"f1":1,"f2":null},2,null,3]'))""",STRING
HIGHtests/dialects/test_mysql.py620 self.validate_identity("SELECT 1 && 0", "SELECT 1 AND 0")CODE
HIGHtests/dialects/test_mysql.py641 self.validate_identity("SELECT a || b", "SELECT a OR b")CODE
HIGH⚡tests/dialects/test_mysql.py1514 "sqlite": "GROUP_CONCAT(a || b || c, ',')",CODE
HIGH⚡tests/dialects/test_mysql.py1516 "postgres": "STRING_AGG(a || b || c, ',')",CODE
35 more matches not shown…
Hyper-Verbose Identifiers589 hits · 499 pts
SeverityFileLineSnippetContext
LOWsqlglotc/setup.py100 def copy_extensions_to_source(self):CODE
LOWsqlglot/transforms.py72def unnest_generate_date_array_using_recursive_cte(expression: exp.Expr) -> exp.Expr:CODE
LOWsqlglot/transforms.py277def remove_precision_parameterized_types(expression: exp.Expr) -> exp.Expr:CODE
LOWsqlglot/transforms.py414def explode_projection_to_unnest(CODE
LOWsqlglot/transforms.py420 def _explode_projection_to_unnest(expression: exp.Expr) -> exp.Expr:CODE
LOWsqlglot/transforms.py608def add_within_group_for_percentiles(expression: exp.Expr) -> exp.Expr:CODE
LOWsqlglot/transforms.py623def remove_within_group_for_percentiles(expression: exp.Expr) -> exp.Expr:CODE
LOWsqlglot/transforms.py637def add_recursive_cte_column_names(expression: exp.Expr) -> exp.Expr:CODE
LOWsqlglot/transforms.py668def eliminate_semi_and_anti_joins(expression: exp.Expr) -> exp.Expr:CODE
LOWsqlglot/transforms.py685def eliminate_full_outer_join(expression: exp.Expr) -> exp.Expr:CODE
LOWsqlglot/transforms.py815def remove_unique_constraints(expression: exp.Expr) -> exp.Expr:CODE
LOWsqlglot/transforms.py824def ctas_with_tmp_tables_to_create_tmp_view(CODE
LOWsqlglot/transforms.py848def move_schema_columns_to_partitioned_by(expression: exp.Expr) -> exp.Expr:CODE
LOWsqlglot/transforms.py871def move_partitioned_by_to_schema_columns(expression: exp.Expr) -> exp.Expr:CODE
LOWsqlglot/transforms.py1089def inherit_struct_field_names(expression: exp.Expr) -> exp.Expr:CODE
LOW⚡sqlglot/parser.py7513 def _parse_user_defined_function_expression(self) -> exp.Expr | None:CODE
LOW⚡sqlglot/parser.py7516 def _parse_function_parameter(self) -> exp.Expr | None:CODE
LOW⚡sqlglot/parser.py7519 def _parse_user_defined_function(self, kind: TokenType | None = None) -> exp.Expr | None:CODE
LOWsqlglot/parser.py110def build_extract_json_with_path(CODE
LOWsqlglot/parser.py307def build_json_extract_scalar(CODE
LOWsqlglot/parser.py324def build_jsonb_extract_scalar(CODE
LOWsqlglot/parser.py330def build_jsonb_contains_top_key(CODE
LOWsqlglot/parser.py1483 def _parse_partitioned_by_bucket_or_truncate(self) -> exp.Expr | None:CODE
LOWsqlglot/parser.py2793 def _parse_sequence_properties(self) -> exp.SequenceProperties | None:CODE
LOWsqlglot/parser.py2851 def _parse_trigger_deferrable(CODE
LOWsqlglot/parser.py2867 def _parse_trigger_referencing_clause(self, keyword: str) -> exp.Expr | None:CODE
LOWsqlglot/parser.py2875 def _parse_trigger_referencing(self) -> exp.TriggerReferencing | None:CODE
LOWsqlglot/parser.py2943 def _parse_wrapped_properties(self) -> list[exp.Expr | list[exp.Expr]]:CODE
LOWsqlglot/parser.py2978 def _parse_key_value_property(CODE
LOWsqlglot/parser.py3034 def _parse_property_assignment(self, exp_class: type[E], **kwargs: t.Any) -> E:CODE
LOWsqlglot/parser.py3076 def _parse_called_on_null_input_property(self) -> exp.CalledOnNullInputProperty | None:CODE
LOWsqlglot/parser.py3101 def _parse_system_versioning_property(CODE
LOWsqlglot/parser.py3125 def _parse_data_deletion_property(self) -> exp.DataDeletionProperty:CODE
LOWsqlglot/parser.py3141 def _parse_distributed_property(self) -> exp.DistributedByProperty:CODE
LOWsqlglot/parser.py3160 def _parse_composite_key_property(self, expr_type: type[E]) -> E:CODE
LOWsqlglot/parser.py3354 def _parse_withisolatedloading(self) -> exp.IsolatedLoadingProperty | None:CODE
LOWsqlglot/parser.py3420 def _parse_partition_bound_spec(self) -> exp.PartitionBoundSpec:CODE
LOWsqlglot/parser.py3421 def _parse_partition_bound_expr() -> exp.Expr | None:CODE
LOWsqlglot/parser.py3551 def _parse_remote_with_connection(self) -> exp.RemoteWithConnectionModelProperty:CODE
LOWsqlglot/parser.py3610 def _parse_multitable_inserts(CODE
LOWsqlglot/parser.py4234 def _parse_recursive_with_search(self) -> exp.RecursiveWithSearch | None:CODE
LOWsqlglot/parser.py4404 def _implicit_unnests_to_explicit(self, this: E) -> E:CODE
LOWsqlglot/parser.py4504 def _parse_hint_fallback_to_string(self) -> exp.Hint | None:CODE
LOWsqlglot/parser.py4512 def _parse_hint_function_call(self) -> exp.Expr | None:CODE
LOWsqlglot/parser.py4570 def _parse_match_recognize_measure(self) -> exp.MatchRecognizeMeasure:CODE
LOWsqlglot/parser.py4746 def _parse_column_as_identifier() -> exp.Expr | None:CODE
LOWsqlglot/parser.py5341 def _parse_derived_table_values(self, allow_value_synonym: bool = False) -> exp.Values | None:CODE
LOWsqlglot/parser.py5483 def _parse_aliased_expression() -> exp.Expr | None:CODE
LOWsqlglot/parser.py5743 def _parse_connect_with_prior(self) -> exp.Expr | None:CODE
LOWsqlglot/parser.py5768 def _parse_name_as_expression(self) -> exp.Expr | None:CODE
LOWsqlglot/parser.py5940 def _can_parse_limit_or_offset(self) -> bool:CODE
LOWsqlglot/parser.py6890 def _parse_vector_expressions(self, expressions: list[exp.Expr]) -> list[exp.Expr]:CODE
LOWsqlglot/parser.py7078 def _parse_colon_as_variant_extract(self, this: exp.Expr | None) -> exp.Expr | None:CODE
LOWsqlglot/parser.py7336 def _parse_connector_function(self, connector: t.Callable[..., exp.Condition]) -> exp.Paren:CODE
LOWsqlglot/parser.py7491 def _parse_function_properties(self) -> exp.Properties | None:CODE
LOWsqlglot/parser.py7793 def _parse_generated_as_identity(CODE
LOWsqlglot/parser.py7900 def _parse_unnamed_constraints(self) -> list[exp.Expr]:CODE
LOWsqlglot/parser.py7910 def _parse_unnamed_constraint(self, constraints: TEXTS_TYPE | None = None) -> exp.Expr | None:CODE
LOWsqlglot/parser.py7949 def _parse_key_constraint_options(self) -> list[str]:CODE
LOWsqlglot/parser.py8030 def _parse_period_for_system_time(self) -> exp.PeriodForSystemTimeConstraint | None:CODE
529 more matches not shown…
Unused Imports261 hits · 246 pts
SeverityFileLineSnippetContext
LOWpdoc/cli.py11CODE
LOWsqlglot/time.py1CODE
LOWsqlglot/planner.py1CODE
LOWsqlglot/transforms.py1CODE
LOWsqlglot/_typing.py1CODE
LOWsqlglot/_typing.py7CODE
LOWsqlglot/serde.py1CODE
LOWsqlglot/__init__.py8CODE
LOWsqlglot/__init__.py10CODE
LOWsqlglot/__init__.py17CODE
LOWsqlglot/__init__.py18CODE
LOWsqlglot/__init__.py19CODE
LOWsqlglot/__init__.py19CODE
LOWsqlglot/__init__.py25CODE
LOWsqlglot/__init__.py25CODE
LOWsqlglot/__init__.py25CODE
LOWsqlglot/__init__.py25CODE
LOWsqlglot/__init__.py25CODE
LOWsqlglot/__init__.py25CODE
LOWsqlglot/__init__.py25CODE
LOWsqlglot/__init__.py25CODE
LOWsqlglot/__init__.py25CODE
LOWsqlglot/__init__.py25CODE
LOWsqlglot/__init__.py25CODE
LOWsqlglot/__init__.py25CODE
LOWsqlglot/__init__.py25CODE
LOWsqlglot/__init__.py25CODE
LOWsqlglot/__init__.py25CODE
LOWsqlglot/__init__.py25CODE
LOWsqlglot/__init__.py25CODE
LOWsqlglot/__init__.py25CODE
LOWsqlglot/__init__.py25CODE
LOWsqlglot/__init__.py25CODE
LOWsqlglot/__init__.py25CODE
LOWsqlglot/__init__.py25CODE
LOWsqlglot/__init__.py25CODE
LOWsqlglot/__init__.py25CODE
LOWsqlglot/__init__.py52CODE
LOWsqlglot/__init__.py53CODE
LOWsqlglot/__init__.py54CODE
LOWsqlglot/__init__.py54CODE
LOWsqlglot/__init__.py55CODE
LOWsqlglot/__init__.py55CODE
LOWsqlglot/__init__.py66CODE
LOWsqlglot/__init__.py66CODE
LOWsqlglot/tokens.py1CODE
LOWsqlglot/tokens.py16CODE
LOWsqlglot/tokenizer_core.py1CODE
LOWsqlglot/parser.py1CODE
LOWsqlglot/generator.py1CODE
LOWsqlglot/helper.py1CODE
LOWsqlglot/helper.py17CODE
LOWsqlglot/helper.py17CODE
LOWsqlglot/diff.py7CODE
LOWsqlglot/errors.py1CODE
LOWsqlglot/anonymize.py1CODE
LOWsqlglot/lineage.py1CODE
LOWsqlglot/__main__.py1CODE
LOWsqlglot/jsonpath.py1CODE
LOWsqlglot/schema.py1CODE
201 more matches not shown…
Deep Nesting219 hits · 181 pts
SeverityFileLineSnippetContext
LOWsqlglot/planner.py49CODE
LOWsqlglot/planner.py134CODE
LOWsqlglot/transforms.py201CODE
LOWsqlglot/transforms.py290CODE
LOWsqlglot/transforms.py309CODE
LOWsqlglot/transforms.py414CODE
LOWsqlglot/transforms.py637CODE
LOWsqlglot/transforms.py668CODE
LOWsqlglot/transforms.py685CODE
LOWsqlglot/transforms.py910CODE
LOWsqlglot/transforms.py1089CODE
LOWsqlglot/transforms.py420CODE
LOWsqlglot/serde.py23CODE
LOWsqlglot/tokenizer_core.py699CODE
LOWsqlglot/tokenizer_core.py822CODE
LOWsqlglot/tokenizer_core.py883CODE
LOWsqlglot/tokenizer_core.py955CODE
LOWsqlglot/tokenizer_core.py1069CODE
LOWsqlglot/tokenizer_core.py1193CODE
LOWsqlglot/tokenizer_core.py1271CODE
LOWsqlglot/parser.py2507CODE
LOWsqlglot/parser.py2793CODE
LOWsqlglot/parser.py2875CODE
LOWsqlglot/parser.py3101CODE
LOWsqlglot/parser.py3125CODE
LOWsqlglot/parser.py3368CODE
LOWsqlglot/parser.py3930CODE
LOWsqlglot/parser.py4074CODE
LOWsqlglot/parser.py4404CODE
LOWsqlglot/parser.py4437CODE
LOWsqlglot/parser.py4578CODE
LOWsqlglot/parser.py4754CODE
LOWsqlglot/parser.py4960CODE
LOWsqlglot/parser.py5094CODE
LOWsqlglot/parser.py5519CODE
LOWsqlglot/parser.py5659CODE
LOWsqlglot/parser.py5977CODE
LOWsqlglot/parser.py6091CODE
LOWsqlglot/parser.py6185CODE
LOWsqlglot/parser.py6269CODE
LOWsqlglot/parser.py6420CODE
LOWsqlglot/parser.py6523CODE
LOWsqlglot/parser.py6606CODE
LOWsqlglot/parser.py6971CODE
LOWsqlglot/parser.py7078CODE
LOWsqlglot/parser.py7138CODE
LOWsqlglot/parser.py7206CODE
LOWsqlglot/parser.py7244CODE
LOWsqlglot/parser.py7344CODE
LOWsqlglot/parser.py7650CODE
LOWsqlglot/parser.py7735CODE
LOWsqlglot/parser.py7949CODE
LOWsqlglot/parser.py8706CODE
LOWsqlglot/parser.py9386CODE
LOWsqlglot/parser.py9434CODE
LOWsqlglot/parser.py9520CODE
LOWsqlglot/parser.py9621CODE
LOWsqlglot/parser.py9660CODE
LOWsqlglot/parser.py9720CODE
LOWsqlglot/parser.py9985CODE
159 more matches not shown…
Docstring Block Structure20 hits · 100 pts
SeverityFileLineSnippetContext
HIGHsqlglot/time.py13 Converts a time string given a mapping. Examples: >>> format_time("%Y", {"%Y": "YYYY"}) 'YYYY'STRING
HIGHsqlglot/helper.py277 Perform a split on a value and return N words as a result with `None` used for words that don't exist. Args: STRING
HIGHsqlglot/helper.py304 Checks if the value is an iterable, excluding the types `str` and `bytes`. Examples: >>> is_iterable([STRING
HIGHsqlglot/helper.py325 Flattens an iterable that can contain both iterable and non-iterable elements. Objects of type `str` and `bytesSTRING
HIGHsqlglot/diff.py74 Returns the list of changes between the source and the target expressions. Examples: >>> from sqlglot STRING
HIGHsqlglot/trie.py45 Checks whether a key is in a trie. Examples: >>> in_trie(new_trie(["cat"]), "bob") (<TrieResulSTRING
HIGHsqlglot/optimizer/qualify_columns.py37 Rewrite sqlglot AST to have fully qualified columns. Example: >>> import sqlglot >>> schema = STRING
HIGHsqlglot/optimizer/qualify_tables.py24 Rewrite sqlglot AST to have fully qualified tables. Join constructs such as (t1 JOIN t2) AS t will be expanded STRING
HIGHsqlglot/optimizer/scope.py668 Traverse an expression by its "scopes". "Scope" represents the current context of a Select statement. ThiSTRING
HIGHsqlglot/dialects/dialect.py2268 Compute the week start day for a week-ish diff unit, e.g BigQuery's WEEK(<day>) or ISOWEEK unit parts. Args: STRING
HIGHsqlglot/expressions/builders.py757Get the full name of a table as a string. Args: table: Table expression node or string. dialect: ThSTRING
HIGHsqlglot/expressions/builders.py815Replace all tables in expression according to the mapping. Args: expression: expression node to be transforSTRING
HIGHsqlglot/expressions/builders.py853Replace placeholders in an expression. Args: expression: expression node to be transformed and replaced. STRING
HIGHsqlglot/expressions/builders.py894Transforms an expression by expanding all referenced sources into subqueries. Examples: >>> from sqlglot imSTRING
HIGHsqlglot/expressions/builders.py937 Returns a Func expression. Examples: >>> func("abs", 5).sql() 'ABS(5)' >>> func("castSTRING
HIGHsqlglot/expressions/builders.py1030 Returns an array. Examples: >>> array(1, 'x').sql() 'ARRAY(1, x)' Args: expressioSTRING
HIGHsqlglot/expressions/builders.py1060 Returns an tuple. Examples: >>> tuple_(1, 'x').sql() '(1, x)' Args: expressions: STRING
HIGHsqlglot/expressions/query.py275 Append to or set the WHERE expressions. Examples: >>> Select().select("x").from_("tbl").whSTRING
HIGHsqlglot/expressions/query.py1660 Set the locking read mode for this expression. Examples: >>> Select().select("x").from_("tSTRING
HIGHsqlglot/expressions/query.py1683 Set hints for this expression. Examples: >>> Select().select("x").from_("tbl").hint("BROADSTRING
Empty Error Handlers10 hits · 50 pts
SeverityFileLineSnippetContext
HIGHsqlglot/tokens.py25except ImportError:CODE
HIGHsqlglot/optimizer/resolver.py64except OptimizeError:CODE
HIGHsqlglot/dialects/dialect.py248except ImportError:CODE
HIGHsqlglot/dialects/dialect.py256except ImportError:CODE
HIGHsqlglot/expressions/builders.py881except StopIteration:CODE
HIGHsqlglot/expressions/core.py1762except Exception:CODE
HIGHsqlglot/executor/python.py178except KeyError:CODE
HIGHsqlglot/generators/duckdb.py1384except Exception:CODE
HIGHsqlglot/generators/duckdb.py2979except ValueError:CODE
HIGHtests/test_jsonpath.py155except (ParseError, TokenError):CODE
Hallucination Indicators2 hits · 25 pts
SeverityFileLineSnippetContext
CRITICALsqlglot/generator.py5483 converted_style = sqlglot.dialects.tsql.TSQL.CONVERT_FORMAT_MAPPING.get(style_value)CODE
CRITICAL⚡tests/test_parser.py1228 sql = "a.b.c.d.e.f.g.foo()"CODE
Redundant / Tautological Comments18 hits · 20 pts
SeverityFileLineSnippetContext
LOWsqlglotc/setup.py82# Set MYPYPATH to the parent of the sqlglot source so mypy resolvesCOMMENT
LOWsqlglot/parsers/bigquery.py680 # Check if this is ML.TRANSLATE by looking at previous tokensCOMMENT
LOWsqlglot/parsers/bigquery.py688 # Check if this is ML.FORECAST by looking at previous tokens.COMMENT
LOWsqlglot/optimizer/qualify_columns.py1027 # Check if current rhs identifier is in structCOMMENT
LOWsqlglot/dialects/dialect.py1645 # Check if ANY argument is NULL and return NULL explicitlyCOMMENT
LOWsqlglot/dialects/dialect.py1725 # Check if both are last day of monthCOMMENT
LOWsqlglot/generators/fabric.py80 # Check if this is a temporal type that needs precision handling. Fabric limits temporalCOMMENT
LOWsqlglot/generators/snowflake.py666 # Check if this is a FLOAT type nested inside a VECTOR typeCOMMENT
LOWsqlglot/generators/snowflake.py1103 # Set part_index to 1 if missingCOMMENT
LOWsqlglot/generators/duckdb.py842 # Check if we need NTZ (naive timestamp in UTC)COMMENT
LOWsqlglot/generators/duckdb.py2345 # Check if we need the end of the slice (default is start)STRING
LOWsqlglot/generators/duckdb.py2755 # Check if target_type requires TIMESTAMPTZ (for LTZ/TZ variants)STRING
LOWsqlglot/generators/duckdb.py2971 # Check if values are within normal ranges - use MAKE_TIME for efficiencySTRING
LOWsqlglot/generators/duckdb.py3071 # Check if this is the date/time expression form: TIMESTAMP_FROM_PARTS(date_expr, time_expr)STRING
LOWsqlglot/generators/duckdb.py3791 # Check if it's a text type (handles both literals and annotated expressions)STRING
LOWsqlglot/generators/duckdb.py3804 # Check if input is a string type - ENCODE only accepts VARCHARSTRING
LOWsqlglot/generators/starrocks.py335 # Verify if the first one is an engine property. Is true then insert it after the engine,COMMENT
LOW.github/scripts/integration_tests_sync.sh108 # Check if there are local commits to pushCOMMENT
AI Slop Vocabulary8 hits · 17 pts
SeverityFileLineSnippetContext
LOWsetup.py11 # for py3.10+; on py3.9 just use upstream mypy for type checking.COMMENT
MEDIUMsqlglot/parser.py6571 # DECIMAL(38, 0)) in order to facilitate the data type's transpilation.COMMENT
MEDIUMsqlglot/generator.py423 # Whether JOIN sides (LEFT, RIGHT) are supported in conjunction with SEMI/ANTI join kindsCOMMENT
MEDIUMsqlglot/generators/snowflake.py326 # This transformation is used to facilitate transpilation of BigQuery `UNNEST` operationsCOMMENT
LOWsqlglot/generators/duckdb.py3171 # DuckDB doesn't, but we can just add a dummy ON clause that is always trueSTRING
LOWsqlglot/generators/duckdb.py3785 # Default DuckDB behavior - just return RANDOM() as floatSTRING
MEDIUMtests/leakcheck.py339 # harness that runs the suite multiple times. ``setdefault`` lets theCOMMENT
MEDIUM.github/scripts/get_integration_test_params.py34# Modules imported by the integration test harness itself, on top of each dialect's moduleCOMMENT
Self-Referential Comments6 hits · 16 pts
SeverityFileLineSnippetContext
MEDIUMsqlglot/lineage.py323 # Create the node for this step in the lineage chain, and attach it to the previous one.COMMENT
MEDIUMsqlglot/expressions/builders.py921 # Create a subquery with the same alias (or table name if no alias)COMMENT
MEDIUMsqlglot/generators/fabric.py83 # Create a new expression with the capped precisionCOMMENT
MEDIUMsqlglot/generators/fabric.py142 # Create the base datetime as '1970-01-01' cast to DATETIME2(6)COMMENT
MEDIUMsqlglot/generators/duckdb.py3955 # Create a single-entry map for the new key-value pairSTRING
MEDIUM.github/scripts/integration_tests_sync.sh127 # Create a PR if one doesn't exist (requires gh CLI)COMMENT
Excessive Try-Catch Wrapping11 hits · 11 pts
SeverityFileLineSnippetContext
LOWsqlglotc/setup.py158 except Exception as e:CODE
LOWpdoc/cli.py21 except Exception:CODE
LOWsqlglot/tokenizer_core.py691 except Exception as e:CODE
LOWsqlglot/tokenizer_core.py1125 except Exception:CODE
LOWsqlglot/expressions/core.py1762 except Exception:CODE
LOWsqlglot/executor/python.py82 except Exception as e:CODE
LOWsqlglot/generators/python.py32 except Exception as ex:CODE
MEDIUMsqlglot/generators/python.py17def _rename(self, e):CODE
LOWsqlglot/generators/duckdb.py1384 except Exception:STRING
LOWtests/gen_fixtures.py572 except Exception as e:CODE
LOWtests/test_docs.py20 except Exception:CODE
Fake / Example Data7 hits · 10 pts
SeverityFileLineSnippetContext
LOW⚡tests/dialects/test_spark.py797 "SELECT RLIKE('John Doe', 'John.*')",CODE
LOW⚡tests/dialects/test_spark.py799 "bigquery": "SELECT REGEXP_CONTAINS('John Doe', 'John.*')",CODE
LOW⚡tests/dialects/test_spark.py800 "hive": "SELECT 'John Doe' RLIKE 'John.*'",CODE
LOW⚡tests/dialects/test_spark.py801 "postgres": "SELECT 'John Doe' ~ 'John.*'",CODE
LOW⚡tests/dialects/test_spark.py802 "snowflake": "SELECT REGEXP_LIKE('John Doe', 'John.*')",CODE
LOW⚡tests/dialects/test_spark.py803 "spark": "SELECT 'John Doe' RLIKE 'John.*'",CODE
LOWtests/dialects/test_postgres.py1111 "SELECT PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY a) FILTER(WHERE CAST(b AS BOOLEAN)) AS mean_value FROM (CODE
Modern Structural Boilerplate7 hits · 8 pts
SeverityFileLineSnippetContext
LOWsqlglot/planner.py155 def set_ops_and_aggs(step) -> None:CODE
LOWsqlglot/optimizer/qualify_columns.py215 def _update_source_columns(source_name: str) -> None:CODE
LOWsqlglot/expressions/core.py291 def _set_parent(self, arg_key: str, value: object, index: int | None = None) -> None:CODE
LOWsqlglot/expressions/core.py1117 def _set_parent(self, arg_key: str, value: object, index: int | None = None) -> None:CODE
LOW⚡sqlglot/executor/context.py96 def set_row(self, row: tuple) -> None:CODE
LOW⚡sqlglot/executor/context.py101 def set_index(self, index: int) -> None:CODE
LOW⚡sqlglot/executor/context.py106 def set_range(self, start: int, end: int) -> None:CODE
Over-Commented Block10 hits · 8 pts
SeverityFileLineSnippetContext
LOWposts/ast_primer.md21# expressions=[COMMENT
LOWposts/ast_primer.md261# x.a AS a,COMMENT
LOWsqlglot/parser.py1941COMMENT
LOWsqlglot/parser.py6561COMMENT
LOWsqlglot/parser.py8801 this = self.expression(COMMENT
LOWsqlglot/parsers/bigquery.py481 table.meta["quoted_table"] = TrueCOMMENT
LOWsqlglot/generators/duckdb.py2021 #COMMENT
LOWsqlglot/generators/duckdb.py2041 # Result: Clean, sorted list of unique non-null integers stored as 'l'COMMENT
LOWsqlglot/generators/duckdb.py2241 x -> NOT x = ''COMMENT
LOWsqlglot/generators/duckdb.py2261 # -- Snowflake: negative indices return NULLCOMMENT
AI Structural Patterns5 hits · 4 pts
SeverityFileLineSnippetContext
LOWsqlglot/generator.py918CODE
LOWsqlglot/generator.py4844CODE
LOWsqlglot/lineage.py200CODE
LOWsqlglot/optimizer/qualify.py19CODE
LOWsqlglot/generators/athena.py133CODE