Python SQL Parser and Transpiler
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.
Use each vector to guide manual verification of the underlying findings.
Can maintainers explain intent, assumptions, and trade-offs? 875 finding(s).
Are imports declared and package/API names verified? 365 finding(s).
Are wrappers, guards, and repeated structures necessary? 622 finding(s).
Which changes need focused human review? 1268 finding(s).
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.
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.
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.
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.
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| HIGH | sqlglot/parser.py | 7589 | # Fast path: simple atom (column, literal, null, bool) followed by , or ) | COMMENT |
| HIGH | sqlglot/parser.py | 3577 | return self.expression(exp.ReturnsProperty(this=value, is_table=is_table, null=null)) | CODE |
| HIGH | sqlglot/parser.py | 8524 | return self.expression(exp.OnCondition(empty=empty, error=error, null=null)) | CODE |
| HIGH | sqlglot/generator.py | 2448 | null = f" NULL DEFINED AS {null}" if null else "" | CODE |
| HIGH | sqlglot/generator.py | 2449 | return f"ROW FORMAT DELIMITED{fields}{escaped}{items}{keys}{lines}{null}" | CODE |
| HIGH | sqlglot/generator.py | 5845 | return f"{empty}{error}{null}" | CODE |
| HIGH | sqlglot/optimizer/simplify.py | 1002 | return false | CODE |
| HIGH | sqlglot/optimizer/simplify.py | 1005 | return false | CODE |
| HIGH | sqlglot/generators/duckdb.py | 3467 | For BINARY: Lower to: input || REPEAT(pad, GREATEST(0, target_len - OCTET_LENGTH(input))) | CODE |
| HIGH | sqlglot/generators/duckdb.py | 569 | DuckDB's native && operator is not NULL-safe: [1,NULL,3] && [NULL,4,5] returns FALSE. | STRING |
| HIGH | sqlglot/generators/duckdb.py | 572 | Generated SQL: (arr1 && arr2) OR (ARRAY_LENGTH(arr1) <> LIST_COUNT(arr1) AND ARRAY_LENGTH(arr2) <> LIST_COUNT(arr2)) | STRING |
| HIGH | sqlglot/generators/duckdb.py | 2062 | WHEN LENGTH(l) < 5 THEN UNHEX(PRINTF('%04X', LENGTH(l)) || h || REPEAT('00', GREATEST(0, 4 - LENGTH(l)) * 2) | STRING |
| HIGH | sqlglot/generators/duckdb.py | 2068 | (__a, __b) -> __a || __b, '' | STRING |
| HIGH | sqlglot/generators/duckdb.py | 4167 | this=exp.Coalesce(this=x, expressions=[null]), | STRING |
| HIGH⚡ | tests/test_optimizer.py | 112 | INSERT INTO x VALUES (null, null); | STRING |
| HIGH⚡ | tests/test_optimizer.py | 118 | INSERT INTO y VALUES (null, null); | STRING |
| HIGH⚡ | tests/test_optimizer.py | 124 | INSERT INTO y VALUES (null, null); | STRING |
| HIGH | tests/test_optimizer.py | 2803 | "SELECT x.cola || TRIM(x.colb) AS col, DATE(x.colb), DATEFROMPARTS(y, m, d) FROM x AS x" | STRING |
| HIGH⚡ | tests/test_executor.py | 1176 | ("a || b", "xy"), | CODE |
| HIGH⚡ | tests/test_executor.py | 1177 | ("a || b || a", "xyx"), | CODE |
| HIGH⚡ | tests/test_executor.py | 1178 | ("a || n", "x1"), | CODE |
| HIGH⚡ | tests/test_executor.py | 1179 | ("n || a", "1x"), | CODE |
| HIGH⚡ | tests/test_executor.py | 1180 | ("a || nul", None), | CODE |
| HIGH⚡ | tests/test_executor.py | 1181 | ("nul || a", None), | CODE |
| HIGH⚡ | tests/test_executor.py | 1182 | ("arr || arr", [1, 2, 1, 2]), | CODE |
| HIGH⚡ | tests/test_executor.py | 1183 | ("arr || n", [1, 2, 1]), | CODE |
| HIGH⚡ | tests/test_executor.py | 1184 | ("n || arr", [1, 1, 2]), | CODE |
| HIGH⚡ | tests/test_executor.py | 1185 | ("arr || nul", None), | CODE |
| HIGH⚡ | tests/test_executor.py | 1196 | rows = execute("SELECT a || n FROM t", tables=tables, dialect="postgres").rows | CODE |
| HIGH⚡ | tests/test_executor.py | 1200 | execute("SELECT a || n FROM t", tables=tables, dialect="trino") | CODE |
| HIGH⚡ | tests/test_executor.py | 1448 | ("ARRAY_JOIN(['hello', null ,'world'], ' ', ',')", "hello , world"), | CODE |
| HIGH⚡ | tests/test_executor.py | 1449 | ("ARRAY_JOIN(['', null ,'world'], ' ', ',')", " , world"), | CODE |
| HIGH⚡ | tests/test_executor.py | 1450 | ("STRUCT('foo', 'bar', null, null)", {"foo": "bar"}), | CODE |
| HIGH | tests/test_transforms.py | 131 | "SELECT x, t, x || t AS z FROM y QUALIFY ROW_NUMBER() OVER (PARTITION BY x ORDER BY z DESC)", | CODE |
| HIGH | tests/test_transforms.py | 132 | "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 |
| HIGH | tests/dialects/test_snowflake.py | 160 | "duckdb": "SELECT (SELECT CASE WHEN l IS NULL OR LENGTH(l) = 0 THEN NULL WHEN LENGTH(l) <> LENGTH(LIST_F | CODE |
| HIGH | tests/dialects/test_snowflake.py | 1352 | "duckdb": "SELECT (col1 && col2) OR (ARRAY_LENGTH(col1) <> LIST_COUNT(col1) AND ARRAY_LENGTH(col2) <> LI | CODE |
| HIGH | tests/dialects/test_snowflake.py | 1378 | "ARRAY_CONSTRUCT_COMPACT(1, null, 2)", | CODE |
| HIGH⚡ | tests/dialects/test_bigquery.py | 2165 | self.validate_identity("""JSON_STRIP_NULLS(PARSE_JSON('[1, null, 2, null, [null]]'))""") | CODE |
| HIGH⚡ | tests/dialects/test_bigquery.py | 2167 | """JSON_STRIP_NULLS(PARSE_JSON('[1, null, 2, null]'), include_arrays => FALSE)""" | STRING |
| HIGH⚡ | tests/dialects/test_bigquery.py | 2170 | """JSON_STRIP_NULLS(PARSE_JSON('{"a": {"b": {"c": null}}, "d": [null], "e": [], "f": 1}'), include_arrays => | STRING |
| HIGH | tests/dialects/test_bigquery.py | 2782 | for value in ('{"a": 1}', '[1, "a", null]', '"foo"', "1", "true", "null"): | CODE |
| HIGH | tests/dialects/test_redshift.py | 265 | 'create table if not exists city_slash_id("city/id" integer not null, state char(2) not null)', | CODE |
| HIGH | tests/dialects/test_duckdb.py | 341 | """SELECT CASE WHEN JSON_TYPE(JSON('{"a": null}') -> '$.a') = 'NULL' THEN NULL ELSE JSON('{"a": null}') -> ' | STRING |
| HIGH | tests/dialects/test_duckdb.py | 343 | "snowflake": """SELECT STRIP_NULL_VALUE(GET_PATH(PARSE_JSON('{"a": null}'), 'a'))""", | CODE |
| HIGH | tests/dialects/test_duckdb.py | 618 | """SELECT '{ "family": "anatidae", "species": [ "duck", "goose", "swan", null ] }' ->> ['$.family', '$.speci | STRING |
| HIGH | tests/dialects/test_duckdb.py | 629 | """SELECT JSON_EXTRACT_STRING('{ "family": "anatidae", "species": [ "duck", "goose", "swan", null ] }', ['$. | STRING |
| HIGH | tests/dialects/test_duckdb.py | 630 | """SELECT '{ "family": "anatidae", "species": [ "duck", "goose", "swan", null ] }' ->> ['$.family', '$.speci | STRING |
| HIGH | tests/dialects/test_duckdb.py | 1443 | self.validate_identity("a && b").assert_is(exp.ArrayOverlaps) | CODE |
| HIGH⚡ | tests/dialects/test_dialect.py | 5116 | "": """JSON_STRIP_NULLS(PARSE_JSON('[{"f1":1,"f2":null},2,null,3]'))""", | CODE |
| HIGH⚡ | tests/dialects/test_dialect.py | 5117 | "bigquery": """JSON_STRIP_NULLS(PARSE_JSON('[{"f1":1,"f2":null},2,null,3]'))""", | CODE |
| HIGH⚡ | tests/dialects/test_dialect.py | 5120 | "bigquery": """JSON_STRIP_NULLS(PARSE_JSON('[{"f1":1,"f2":null},2,null,3]'))""", | CODE |
| HIGH⚡ | tests/dialects/test_dialect.py | 5121 | "postgres": """JSON_STRIP_NULLS(CAST('[{"f1":1,"f2":null},2,null,3]' AS JSON))""", | CODE |
| HIGH | tests/dialects/test_dialect.py | 2316 | "redshift": "a || b || c", | CODE |
| HIGH | tests/dialects/test_dialect.py | 2317 | "sqlite": "a || b || c", | CODE |
| HIGH⚡ | tests/dialects/test_dialect.py | 5114 | """JSON_STRIP_NULLS(PARSE_JSON('[{"f1":1,"f2":null},2,null,3]'))""", | STRING |
| HIGH | tests/dialects/test_mysql.py | 620 | self.validate_identity("SELECT 1 && 0", "SELECT 1 AND 0") | CODE |
| HIGH | tests/dialects/test_mysql.py | 641 | self.validate_identity("SELECT a || b", "SELECT a OR b") | CODE |
| HIGH⚡ | tests/dialects/test_mysql.py | 1514 | "sqlite": "GROUP_CONCAT(a || b || c, ',')", | CODE |
| HIGH⚡ | tests/dialects/test_mysql.py | 1516 | "postgres": "STRING_AGG(a || b || c, ',')", | CODE |
| 35 more matches not shown… | ||||
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | sqlglotc/setup.py | 100 | def copy_extensions_to_source(self): | CODE |
| LOW | sqlglot/transforms.py | 72 | def unnest_generate_date_array_using_recursive_cte(expression: exp.Expr) -> exp.Expr: | CODE |
| LOW | sqlglot/transforms.py | 277 | def remove_precision_parameterized_types(expression: exp.Expr) -> exp.Expr: | CODE |
| LOW | sqlglot/transforms.py | 414 | def explode_projection_to_unnest( | CODE |
| LOW | sqlglot/transforms.py | 420 | def _explode_projection_to_unnest(expression: exp.Expr) -> exp.Expr: | CODE |
| LOW | sqlglot/transforms.py | 608 | def add_within_group_for_percentiles(expression: exp.Expr) -> exp.Expr: | CODE |
| LOW | sqlglot/transforms.py | 623 | def remove_within_group_for_percentiles(expression: exp.Expr) -> exp.Expr: | CODE |
| LOW | sqlglot/transforms.py | 637 | def add_recursive_cte_column_names(expression: exp.Expr) -> exp.Expr: | CODE |
| LOW | sqlglot/transforms.py | 668 | def eliminate_semi_and_anti_joins(expression: exp.Expr) -> exp.Expr: | CODE |
| LOW | sqlglot/transforms.py | 685 | def eliminate_full_outer_join(expression: exp.Expr) -> exp.Expr: | CODE |
| LOW | sqlglot/transforms.py | 815 | def remove_unique_constraints(expression: exp.Expr) -> exp.Expr: | CODE |
| LOW | sqlglot/transforms.py | 824 | def ctas_with_tmp_tables_to_create_tmp_view( | CODE |
| LOW | sqlglot/transforms.py | 848 | def move_schema_columns_to_partitioned_by(expression: exp.Expr) -> exp.Expr: | CODE |
| LOW | sqlglot/transforms.py | 871 | def move_partitioned_by_to_schema_columns(expression: exp.Expr) -> exp.Expr: | CODE |
| LOW | sqlglot/transforms.py | 1089 | def inherit_struct_field_names(expression: exp.Expr) -> exp.Expr: | CODE |
| LOW⚡ | sqlglot/parser.py | 7513 | def _parse_user_defined_function_expression(self) -> exp.Expr | None: | CODE |
| LOW⚡ | sqlglot/parser.py | 7516 | def _parse_function_parameter(self) -> exp.Expr | None: | CODE |
| LOW⚡ | sqlglot/parser.py | 7519 | def _parse_user_defined_function(self, kind: TokenType | None = None) -> exp.Expr | None: | CODE |
| LOW | sqlglot/parser.py | 110 | def build_extract_json_with_path( | CODE |
| LOW | sqlglot/parser.py | 307 | def build_json_extract_scalar( | CODE |
| LOW | sqlglot/parser.py | 324 | def build_jsonb_extract_scalar( | CODE |
| LOW | sqlglot/parser.py | 330 | def build_jsonb_contains_top_key( | CODE |
| LOW | sqlglot/parser.py | 1483 | def _parse_partitioned_by_bucket_or_truncate(self) -> exp.Expr | None: | CODE |
| LOW | sqlglot/parser.py | 2793 | def _parse_sequence_properties(self) -> exp.SequenceProperties | None: | CODE |
| LOW | sqlglot/parser.py | 2851 | def _parse_trigger_deferrable( | CODE |
| LOW | sqlglot/parser.py | 2867 | def _parse_trigger_referencing_clause(self, keyword: str) -> exp.Expr | None: | CODE |
| LOW | sqlglot/parser.py | 2875 | def _parse_trigger_referencing(self) -> exp.TriggerReferencing | None: | CODE |
| LOW | sqlglot/parser.py | 2943 | def _parse_wrapped_properties(self) -> list[exp.Expr | list[exp.Expr]]: | CODE |
| LOW | sqlglot/parser.py | 2978 | def _parse_key_value_property( | CODE |
| LOW | sqlglot/parser.py | 3034 | def _parse_property_assignment(self, exp_class: type[E], **kwargs: t.Any) -> E: | CODE |
| LOW | sqlglot/parser.py | 3076 | def _parse_called_on_null_input_property(self) -> exp.CalledOnNullInputProperty | None: | CODE |
| LOW | sqlglot/parser.py | 3101 | def _parse_system_versioning_property( | CODE |
| LOW | sqlglot/parser.py | 3125 | def _parse_data_deletion_property(self) -> exp.DataDeletionProperty: | CODE |
| LOW | sqlglot/parser.py | 3141 | def _parse_distributed_property(self) -> exp.DistributedByProperty: | CODE |
| LOW | sqlglot/parser.py | 3160 | def _parse_composite_key_property(self, expr_type: type[E]) -> E: | CODE |
| LOW | sqlglot/parser.py | 3354 | def _parse_withisolatedloading(self) -> exp.IsolatedLoadingProperty | None: | CODE |
| LOW | sqlglot/parser.py | 3420 | def _parse_partition_bound_spec(self) -> exp.PartitionBoundSpec: | CODE |
| LOW | sqlglot/parser.py | 3421 | def _parse_partition_bound_expr() -> exp.Expr | None: | CODE |
| LOW | sqlglot/parser.py | 3551 | def _parse_remote_with_connection(self) -> exp.RemoteWithConnectionModelProperty: | CODE |
| LOW | sqlglot/parser.py | 3610 | def _parse_multitable_inserts( | CODE |
| LOW | sqlglot/parser.py | 4234 | def _parse_recursive_with_search(self) -> exp.RecursiveWithSearch | None: | CODE |
| LOW | sqlglot/parser.py | 4404 | def _implicit_unnests_to_explicit(self, this: E) -> E: | CODE |
| LOW | sqlglot/parser.py | 4504 | def _parse_hint_fallback_to_string(self) -> exp.Hint | None: | CODE |
| LOW | sqlglot/parser.py | 4512 | def _parse_hint_function_call(self) -> exp.Expr | None: | CODE |
| LOW | sqlglot/parser.py | 4570 | def _parse_match_recognize_measure(self) -> exp.MatchRecognizeMeasure: | CODE |
| LOW | sqlglot/parser.py | 4746 | def _parse_column_as_identifier() -> exp.Expr | None: | CODE |
| LOW | sqlglot/parser.py | 5341 | def _parse_derived_table_values(self, allow_value_synonym: bool = False) -> exp.Values | None: | CODE |
| LOW | sqlglot/parser.py | 5483 | def _parse_aliased_expression() -> exp.Expr | None: | CODE |
| LOW | sqlglot/parser.py | 5743 | def _parse_connect_with_prior(self) -> exp.Expr | None: | CODE |
| LOW | sqlglot/parser.py | 5768 | def _parse_name_as_expression(self) -> exp.Expr | None: | CODE |
| LOW | sqlglot/parser.py | 5940 | def _can_parse_limit_or_offset(self) -> bool: | CODE |
| LOW | sqlglot/parser.py | 6890 | def _parse_vector_expressions(self, expressions: list[exp.Expr]) -> list[exp.Expr]: | CODE |
| LOW | sqlglot/parser.py | 7078 | def _parse_colon_as_variant_extract(self, this: exp.Expr | None) -> exp.Expr | None: | CODE |
| LOW | sqlglot/parser.py | 7336 | def _parse_connector_function(self, connector: t.Callable[..., exp.Condition]) -> exp.Paren: | CODE |
| LOW | sqlglot/parser.py | 7491 | def _parse_function_properties(self) -> exp.Properties | None: | CODE |
| LOW | sqlglot/parser.py | 7793 | def _parse_generated_as_identity( | CODE |
| LOW | sqlglot/parser.py | 7900 | def _parse_unnamed_constraints(self) -> list[exp.Expr]: | CODE |
| LOW | sqlglot/parser.py | 7910 | def _parse_unnamed_constraint(self, constraints: TEXTS_TYPE | None = None) -> exp.Expr | None: | CODE |
| LOW | sqlglot/parser.py | 7949 | def _parse_key_constraint_options(self) -> list[str]: | CODE |
| LOW | sqlglot/parser.py | 8030 | def _parse_period_for_system_time(self) -> exp.PeriodForSystemTimeConstraint | None: | CODE |
| 529 more matches not shown… | ||||
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | pdoc/cli.py | 11 | CODE | |
| LOW | sqlglot/time.py | 1 | CODE | |
| LOW | sqlglot/planner.py | 1 | CODE | |
| LOW | sqlglot/transforms.py | 1 | CODE | |
| LOW | sqlglot/_typing.py | 1 | CODE | |
| LOW | sqlglot/_typing.py | 7 | CODE | |
| LOW | sqlglot/serde.py | 1 | CODE | |
| LOW | sqlglot/__init__.py | 8 | CODE | |
| LOW | sqlglot/__init__.py | 10 | CODE | |
| LOW | sqlglot/__init__.py | 17 | CODE | |
| LOW | sqlglot/__init__.py | 18 | CODE | |
| LOW | sqlglot/__init__.py | 19 | CODE | |
| LOW | sqlglot/__init__.py | 19 | CODE | |
| LOW | sqlglot/__init__.py | 25 | CODE | |
| LOW | sqlglot/__init__.py | 25 | CODE | |
| LOW | sqlglot/__init__.py | 25 | CODE | |
| LOW | sqlglot/__init__.py | 25 | CODE | |
| LOW | sqlglot/__init__.py | 25 | CODE | |
| LOW | sqlglot/__init__.py | 25 | CODE | |
| LOW | sqlglot/__init__.py | 25 | CODE | |
| LOW | sqlglot/__init__.py | 25 | CODE | |
| LOW | sqlglot/__init__.py | 25 | CODE | |
| LOW | sqlglot/__init__.py | 25 | CODE | |
| LOW | sqlglot/__init__.py | 25 | CODE | |
| LOW | sqlglot/__init__.py | 25 | CODE | |
| LOW | sqlglot/__init__.py | 25 | CODE | |
| LOW | sqlglot/__init__.py | 25 | CODE | |
| LOW | sqlglot/__init__.py | 25 | CODE | |
| LOW | sqlglot/__init__.py | 25 | CODE | |
| LOW | sqlglot/__init__.py | 25 | CODE | |
| LOW | sqlglot/__init__.py | 25 | CODE | |
| LOW | sqlglot/__init__.py | 25 | CODE | |
| LOW | sqlglot/__init__.py | 25 | CODE | |
| LOW | sqlglot/__init__.py | 25 | CODE | |
| LOW | sqlglot/__init__.py | 25 | CODE | |
| LOW | sqlglot/__init__.py | 25 | CODE | |
| LOW | sqlglot/__init__.py | 25 | CODE | |
| LOW | sqlglot/__init__.py | 52 | CODE | |
| LOW | sqlglot/__init__.py | 53 | CODE | |
| LOW | sqlglot/__init__.py | 54 | CODE | |
| LOW | sqlglot/__init__.py | 54 | CODE | |
| LOW | sqlglot/__init__.py | 55 | CODE | |
| LOW | sqlglot/__init__.py | 55 | CODE | |
| LOW | sqlglot/__init__.py | 66 | CODE | |
| LOW | sqlglot/__init__.py | 66 | CODE | |
| LOW | sqlglot/tokens.py | 1 | CODE | |
| LOW | sqlglot/tokens.py | 16 | CODE | |
| LOW | sqlglot/tokenizer_core.py | 1 | CODE | |
| LOW | sqlglot/parser.py | 1 | CODE | |
| LOW | sqlglot/generator.py | 1 | CODE | |
| LOW | sqlglot/helper.py | 1 | CODE | |
| LOW | sqlglot/helper.py | 17 | CODE | |
| LOW | sqlglot/helper.py | 17 | CODE | |
| LOW | sqlglot/diff.py | 7 | CODE | |
| LOW | sqlglot/errors.py | 1 | CODE | |
| LOW | sqlglot/anonymize.py | 1 | CODE | |
| LOW | sqlglot/lineage.py | 1 | CODE | |
| LOW | sqlglot/__main__.py | 1 | CODE | |
| LOW | sqlglot/jsonpath.py | 1 | CODE | |
| LOW | sqlglot/schema.py | 1 | CODE | |
| 201 more matches not shown… | ||||
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | sqlglot/planner.py | 49 | CODE | |
| LOW | sqlglot/planner.py | 134 | CODE | |
| LOW | sqlglot/transforms.py | 201 | CODE | |
| LOW | sqlglot/transforms.py | 290 | CODE | |
| LOW | sqlglot/transforms.py | 309 | CODE | |
| LOW | sqlglot/transforms.py | 414 | CODE | |
| LOW | sqlglot/transforms.py | 637 | CODE | |
| LOW | sqlglot/transforms.py | 668 | CODE | |
| LOW | sqlglot/transforms.py | 685 | CODE | |
| LOW | sqlglot/transforms.py | 910 | CODE | |
| LOW | sqlglot/transforms.py | 1089 | CODE | |
| LOW | sqlglot/transforms.py | 420 | CODE | |
| LOW | sqlglot/serde.py | 23 | CODE | |
| LOW | sqlglot/tokenizer_core.py | 699 | CODE | |
| LOW | sqlglot/tokenizer_core.py | 822 | CODE | |
| LOW | sqlglot/tokenizer_core.py | 883 | CODE | |
| LOW | sqlglot/tokenizer_core.py | 955 | CODE | |
| LOW | sqlglot/tokenizer_core.py | 1069 | CODE | |
| LOW | sqlglot/tokenizer_core.py | 1193 | CODE | |
| LOW | sqlglot/tokenizer_core.py | 1271 | CODE | |
| LOW | sqlglot/parser.py | 2507 | CODE | |
| LOW | sqlglot/parser.py | 2793 | CODE | |
| LOW | sqlglot/parser.py | 2875 | CODE | |
| LOW | sqlglot/parser.py | 3101 | CODE | |
| LOW | sqlglot/parser.py | 3125 | CODE | |
| LOW | sqlglot/parser.py | 3368 | CODE | |
| LOW | sqlglot/parser.py | 3930 | CODE | |
| LOW | sqlglot/parser.py | 4074 | CODE | |
| LOW | sqlglot/parser.py | 4404 | CODE | |
| LOW | sqlglot/parser.py | 4437 | CODE | |
| LOW | sqlglot/parser.py | 4578 | CODE | |
| LOW | sqlglot/parser.py | 4754 | CODE | |
| LOW | sqlglot/parser.py | 4960 | CODE | |
| LOW | sqlglot/parser.py | 5094 | CODE | |
| LOW | sqlglot/parser.py | 5519 | CODE | |
| LOW | sqlglot/parser.py | 5659 | CODE | |
| LOW | sqlglot/parser.py | 5977 | CODE | |
| LOW | sqlglot/parser.py | 6091 | CODE | |
| LOW | sqlglot/parser.py | 6185 | CODE | |
| LOW | sqlglot/parser.py | 6269 | CODE | |
| LOW | sqlglot/parser.py | 6420 | CODE | |
| LOW | sqlglot/parser.py | 6523 | CODE | |
| LOW | sqlglot/parser.py | 6606 | CODE | |
| LOW | sqlglot/parser.py | 6971 | CODE | |
| LOW | sqlglot/parser.py | 7078 | CODE | |
| LOW | sqlglot/parser.py | 7138 | CODE | |
| LOW | sqlglot/parser.py | 7206 | CODE | |
| LOW | sqlglot/parser.py | 7244 | CODE | |
| LOW | sqlglot/parser.py | 7344 | CODE | |
| LOW | sqlglot/parser.py | 7650 | CODE | |
| LOW | sqlglot/parser.py | 7735 | CODE | |
| LOW | sqlglot/parser.py | 7949 | CODE | |
| LOW | sqlglot/parser.py | 8706 | CODE | |
| LOW | sqlglot/parser.py | 9386 | CODE | |
| LOW | sqlglot/parser.py | 9434 | CODE | |
| LOW | sqlglot/parser.py | 9520 | CODE | |
| LOW | sqlglot/parser.py | 9621 | CODE | |
| LOW | sqlglot/parser.py | 9660 | CODE | |
| LOW | sqlglot/parser.py | 9720 | CODE | |
| LOW | sqlglot/parser.py | 9985 | CODE | |
| 159 more matches not shown… | ||||
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| HIGH | sqlglot/time.py | 13 | Converts a time string given a mapping. Examples: >>> format_time("%Y", {"%Y": "YYYY"}) 'YYYY' | STRING |
| HIGH | sqlglot/helper.py | 277 | Perform a split on a value and return N words as a result with `None` used for words that don't exist. Args: | STRING |
| HIGH | sqlglot/helper.py | 304 | Checks if the value is an iterable, excluding the types `str` and `bytes`. Examples: >>> is_iterable([ | STRING |
| HIGH | sqlglot/helper.py | 325 | Flattens an iterable that can contain both iterable and non-iterable elements. Objects of type `str` and `bytes | STRING |
| HIGH | sqlglot/diff.py | 74 | Returns the list of changes between the source and the target expressions. Examples: >>> from sqlglot | STRING |
| HIGH | sqlglot/trie.py | 45 | Checks whether a key is in a trie. Examples: >>> in_trie(new_trie(["cat"]), "bob") (<TrieResul | STRING |
| HIGH | sqlglot/optimizer/qualify_columns.py | 37 | Rewrite sqlglot AST to have fully qualified columns. Example: >>> import sqlglot >>> schema = | STRING |
| HIGH | sqlglot/optimizer/qualify_tables.py | 24 | Rewrite sqlglot AST to have fully qualified tables. Join constructs such as (t1 JOIN t2) AS t will be expanded | STRING |
| HIGH | sqlglot/optimizer/scope.py | 668 | Traverse an expression by its "scopes". "Scope" represents the current context of a Select statement. Thi | STRING |
| HIGH | sqlglot/dialects/dialect.py | 2268 | Compute the week start day for a week-ish diff unit, e.g BigQuery's WEEK(<day>) or ISOWEEK unit parts. Args: | STRING |
| HIGH | sqlglot/expressions/builders.py | 757 | Get the full name of a table as a string. Args: table: Table expression node or string. dialect: Th | STRING |
| HIGH | sqlglot/expressions/builders.py | 815 | Replace all tables in expression according to the mapping. Args: expression: expression node to be transfor | STRING |
| HIGH | sqlglot/expressions/builders.py | 853 | Replace placeholders in an expression. Args: expression: expression node to be transformed and replaced. | STRING |
| HIGH | sqlglot/expressions/builders.py | 894 | Transforms an expression by expanding all referenced sources into subqueries. Examples: >>> from sqlglot im | STRING |
| HIGH | sqlglot/expressions/builders.py | 937 | Returns a Func expression. Examples: >>> func("abs", 5).sql() 'ABS(5)' >>> func("cast | STRING |
| HIGH | sqlglot/expressions/builders.py | 1030 | Returns an array. Examples: >>> array(1, 'x').sql() 'ARRAY(1, x)' Args: expressio | STRING |
| HIGH | sqlglot/expressions/builders.py | 1060 | Returns an tuple. Examples: >>> tuple_(1, 'x').sql() '(1, x)' Args: expressions: | STRING |
| HIGH | sqlglot/expressions/query.py | 275 | Append to or set the WHERE expressions. Examples: >>> Select().select("x").from_("tbl").wh | STRING |
| HIGH | sqlglot/expressions/query.py | 1660 | Set the locking read mode for this expression. Examples: >>> Select().select("x").from_("t | STRING |
| HIGH | sqlglot/expressions/query.py | 1683 | Set hints for this expression. Examples: >>> Select().select("x").from_("tbl").hint("BROAD | STRING |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| HIGH | sqlglot/tokens.py | 25 | except ImportError: | CODE |
| HIGH | sqlglot/optimizer/resolver.py | 64 | except OptimizeError: | CODE |
| HIGH | sqlglot/dialects/dialect.py | 248 | except ImportError: | CODE |
| HIGH | sqlglot/dialects/dialect.py | 256 | except ImportError: | CODE |
| HIGH | sqlglot/expressions/builders.py | 881 | except StopIteration: | CODE |
| HIGH | sqlglot/expressions/core.py | 1762 | except Exception: | CODE |
| HIGH | sqlglot/executor/python.py | 178 | except KeyError: | CODE |
| HIGH | sqlglot/generators/duckdb.py | 1384 | except Exception: | CODE |
| HIGH | sqlglot/generators/duckdb.py | 2979 | except ValueError: | CODE |
| HIGH | tests/test_jsonpath.py | 155 | except (ParseError, TokenError): | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| CRITICAL | sqlglot/generator.py | 5483 | converted_style = sqlglot.dialects.tsql.TSQL.CONVERT_FORMAT_MAPPING.get(style_value) | CODE |
| CRITICAL⚡ | tests/test_parser.py | 1228 | sql = "a.b.c.d.e.f.g.foo()" | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | sqlglotc/setup.py | 82 | # Set MYPYPATH to the parent of the sqlglot source so mypy resolves | COMMENT |
| LOW | sqlglot/parsers/bigquery.py | 680 | # Check if this is ML.TRANSLATE by looking at previous tokens | COMMENT |
| LOW | sqlglot/parsers/bigquery.py | 688 | # Check if this is ML.FORECAST by looking at previous tokens. | COMMENT |
| LOW | sqlglot/optimizer/qualify_columns.py | 1027 | # Check if current rhs identifier is in struct | COMMENT |
| LOW | sqlglot/dialects/dialect.py | 1645 | # Check if ANY argument is NULL and return NULL explicitly | COMMENT |
| LOW | sqlglot/dialects/dialect.py | 1725 | # Check if both are last day of month | COMMENT |
| LOW | sqlglot/generators/fabric.py | 80 | # Check if this is a temporal type that needs precision handling. Fabric limits temporal | COMMENT |
| LOW | sqlglot/generators/snowflake.py | 666 | # Check if this is a FLOAT type nested inside a VECTOR type | COMMENT |
| LOW | sqlglot/generators/snowflake.py | 1103 | # Set part_index to 1 if missing | COMMENT |
| LOW | sqlglot/generators/duckdb.py | 842 | # Check if we need NTZ (naive timestamp in UTC) | COMMENT |
| LOW | sqlglot/generators/duckdb.py | 2345 | # Check if we need the end of the slice (default is start) | STRING |
| LOW | sqlglot/generators/duckdb.py | 2755 | # Check if target_type requires TIMESTAMPTZ (for LTZ/TZ variants) | STRING |
| LOW | sqlglot/generators/duckdb.py | 2971 | # Check if values are within normal ranges - use MAKE_TIME for efficiency | STRING |
| LOW | sqlglot/generators/duckdb.py | 3071 | # Check if this is the date/time expression form: TIMESTAMP_FROM_PARTS(date_expr, time_expr) | STRING |
| LOW | sqlglot/generators/duckdb.py | 3791 | # Check if it's a text type (handles both literals and annotated expressions) | STRING |
| LOW | sqlglot/generators/duckdb.py | 3804 | # Check if input is a string type - ENCODE only accepts VARCHAR | STRING |
| LOW | sqlglot/generators/starrocks.py | 335 | # Verify if the first one is an engine property. Is true then insert it after the engine, | COMMENT |
| LOW | .github/scripts/integration_tests_sync.sh | 108 | # Check if there are local commits to push | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | setup.py | 11 | # for py3.10+; on py3.9 just use upstream mypy for type checking. | COMMENT |
| MEDIUM | sqlglot/parser.py | 6571 | # DECIMAL(38, 0)) in order to facilitate the data type's transpilation. | COMMENT |
| MEDIUM | sqlglot/generator.py | 423 | # Whether JOIN sides (LEFT, RIGHT) are supported in conjunction with SEMI/ANTI join kinds | COMMENT |
| MEDIUM | sqlglot/generators/snowflake.py | 326 | # This transformation is used to facilitate transpilation of BigQuery `UNNEST` operations | COMMENT |
| LOW | sqlglot/generators/duckdb.py | 3171 | # DuckDB doesn't, but we can just add a dummy ON clause that is always true | STRING |
| LOW | sqlglot/generators/duckdb.py | 3785 | # Default DuckDB behavior - just return RANDOM() as float | STRING |
| MEDIUM | tests/leakcheck.py | 339 | # harness that runs the suite multiple times. ``setdefault`` lets the | COMMENT |
| MEDIUM | .github/scripts/get_integration_test_params.py | 34 | # Modules imported by the integration test harness itself, on top of each dialect's module | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | sqlglot/lineage.py | 323 | # Create the node for this step in the lineage chain, and attach it to the previous one. | COMMENT |
| MEDIUM | sqlglot/expressions/builders.py | 921 | # Create a subquery with the same alias (or table name if no alias) | COMMENT |
| MEDIUM | sqlglot/generators/fabric.py | 83 | # Create a new expression with the capped precision | COMMENT |
| MEDIUM | sqlglot/generators/fabric.py | 142 | # Create the base datetime as '1970-01-01' cast to DATETIME2(6) | COMMENT |
| MEDIUM | sqlglot/generators/duckdb.py | 3955 | # Create a single-entry map for the new key-value pair | STRING |
| MEDIUM | .github/scripts/integration_tests_sync.sh | 127 | # Create a PR if one doesn't exist (requires gh CLI) | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | sqlglotc/setup.py | 158 | except Exception as e: | CODE |
| LOW | pdoc/cli.py | 21 | except Exception: | CODE |
| LOW | sqlglot/tokenizer_core.py | 691 | except Exception as e: | CODE |
| LOW | sqlglot/tokenizer_core.py | 1125 | except Exception: | CODE |
| LOW | sqlglot/expressions/core.py | 1762 | except Exception: | CODE |
| LOW | sqlglot/executor/python.py | 82 | except Exception as e: | CODE |
| LOW | sqlglot/generators/python.py | 32 | except Exception as ex: | CODE |
| MEDIUM | sqlglot/generators/python.py | 17 | def _rename(self, e): | CODE |
| LOW | sqlglot/generators/duckdb.py | 1384 | except Exception: | STRING |
| LOW | tests/gen_fixtures.py | 572 | except Exception as e: | CODE |
| LOW | tests/test_docs.py | 20 | except Exception: | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW⚡ | tests/dialects/test_spark.py | 797 | "SELECT RLIKE('John Doe', 'John.*')", | CODE |
| LOW⚡ | tests/dialects/test_spark.py | 799 | "bigquery": "SELECT REGEXP_CONTAINS('John Doe', 'John.*')", | CODE |
| LOW⚡ | tests/dialects/test_spark.py | 800 | "hive": "SELECT 'John Doe' RLIKE 'John.*'", | CODE |
| LOW⚡ | tests/dialects/test_spark.py | 801 | "postgres": "SELECT 'John Doe' ~ 'John.*'", | CODE |
| LOW⚡ | tests/dialects/test_spark.py | 802 | "snowflake": "SELECT REGEXP_LIKE('John Doe', 'John.*')", | CODE |
| LOW⚡ | tests/dialects/test_spark.py | 803 | "spark": "SELECT 'John Doe' RLIKE 'John.*'", | CODE |
| LOW | tests/dialects/test_postgres.py | 1111 | "SELECT PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY a) FILTER(WHERE CAST(b AS BOOLEAN)) AS mean_value FROM ( | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | sqlglot/planner.py | 155 | def set_ops_and_aggs(step) -> None: | CODE |
| LOW | sqlglot/optimizer/qualify_columns.py | 215 | def _update_source_columns(source_name: str) -> None: | CODE |
| LOW | sqlglot/expressions/core.py | 291 | def _set_parent(self, arg_key: str, value: object, index: int | None = None) -> None: | CODE |
| LOW | sqlglot/expressions/core.py | 1117 | def _set_parent(self, arg_key: str, value: object, index: int | None = None) -> None: | CODE |
| LOW⚡ | sqlglot/executor/context.py | 96 | def set_row(self, row: tuple) -> None: | CODE |
| LOW⚡ | sqlglot/executor/context.py | 101 | def set_index(self, index: int) -> None: | CODE |
| LOW⚡ | sqlglot/executor/context.py | 106 | def set_range(self, start: int, end: int) -> None: | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | posts/ast_primer.md | 21 | # expressions=[ | COMMENT |
| LOW | posts/ast_primer.md | 261 | # x.a AS a, | COMMENT |
| LOW | sqlglot/parser.py | 1941 | COMMENT | |
| LOW | sqlglot/parser.py | 6561 | COMMENT | |
| LOW | sqlglot/parser.py | 8801 | this = self.expression( | COMMENT |
| LOW | sqlglot/parsers/bigquery.py | 481 | table.meta["quoted_table"] = True | COMMENT |
| LOW | sqlglot/generators/duckdb.py | 2021 | # | COMMENT |
| LOW | sqlglot/generators/duckdb.py | 2041 | # Result: Clean, sorted list of unique non-null integers stored as 'l' | COMMENT |
| LOW | sqlglot/generators/duckdb.py | 2241 | x -> NOT x = '' | COMMENT |
| LOW | sqlglot/generators/duckdb.py | 2261 | # -- Snowflake: negative indices return NULL | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | sqlglot/generator.py | 918 | CODE | |
| LOW | sqlglot/generator.py | 4844 | CODE | |
| LOW | sqlglot/lineage.py | 200 | CODE | |
| LOW | sqlglot/optimizer/qualify.py | 19 | CODE | |
| LOW | sqlglot/generators/athena.py | 133 | CODE |