Repository Analysis

tobymao/sqlglot

Python SQL Parser and Transpiler

10.1 Low AI signal View on GitHub

Analysis Overview

This report presents the forensic synthetic code analysis of tobymao/sqlglot, a Python project with 9,423 GitHub stars. SynthScan v2.0 examined 135,588 lines of code across 265 source files, recording 1059 pattern matches distributed across 14 syntactic categories. The overall adjusted score of 10.1 places this repository in the Low AI signal band.

The scanner applied 160+ deterministic lexical heuristics, multi-line block detectors, abstract syntax tree depth profilers, and a cross-file Jaccard similarity matrix to construct a statistically normalised synthetic code estimate. All matches are individually weighted by severity coefficient and contextual multiplier before summation, and the resulting headline score is temporally discounted to account for the repository's development history relative to the commercial emergence of large language model coding tooling (November 2022 onward).

10.1
Adjusted Score
10.1
Raw Score
100%
Time Factor
2026-07-14
Last Push
9.4K
Stars
Python
Language
135.6K
Lines of Code
265
Files
1.1K
Pattern Hits
2026-07-14
Scan Date
0.33
HC Hit Rate

What These Metrics Mean

Adjusted Score
Primary synthetic code indicator. Raw score normalised per 1,000 lines of code and multiplied by the temporal discount factor. This is the definitive comparative metric — use it to rank repositories by AI authorship density.
Raw Score
The unmodified sum of all severity-weighted, context-multiplied pattern match scores before temporal discounting. Reflects the absolute signal strength independent of when the repository was last active.
Time Factor
The temporal discount multiplier (0–100%) applied to the raw score. Repositories last updated before ChatGPT's launch (Nov 2022) receive a 5% factor. Full signal is only assigned to repositories active in the post-adoption era (Jan 2024+).
Pattern Hits
Total count of individual pattern matches across all files and categories. A high hit count with a low score may indicate a very large codebase with isolated AI snippets; a low count with a high score indicates dense, concentrated AI signatures.
HC Hit Rate
High+Critical pattern hits per file, averaged across the repository. This orthogonal signal catches repositories where a few files are densely packed with high-severity AI tells — a strong indicator even when the normalised score appears moderate due to codebase size.
Lines of Code / Files
Total lines and files analysed. The scanner examines 94 file extensions. These denominators are used to normalise the score, enabling fair comparison between repositories of vastly different sizes.

Score History

This chart maps the temporal evolution of the adjusted synthetic code score across successive scan runs. An upward trajectory indicates ongoing incorporation of AI-generated code or expanding LLM-assisted scaffolding; a stable or declining trajectory may reflect active human refactoring, code removal, or the adoption of stricter authorship policies. The dashed secondary line (right axis) independently tracks total raw pattern hit count, which can diverge from the normalised score when codebase size changes significantly between scans.

Severity Breakdown

Classifies detected patterns by their diagnostic confidence and structural impact. CRITICAL patterns (coefficient 10) represent definitive synthetic signatures — hallucinated imports, explicit LLM attribution metadata — virtually never produced by human authors. HIGH (5) indicates strong structural tells such as cross-file repetition or cross-linguistic idioms. MEDIUM (2) covers recognisable conversational padding and AI-specific vocabulary. LOW (1) captures subtle indicators like tautological comments and generic boilerplate that require density to carry independent signal.

CRITICAL 2HIGH 85MEDIUM 11LOW 961

Directory Score Breakdown

This horizontal bar chart decomposes the repository's raw synthetic code score by top-level directory, allowing you to pinpoint precisely which modules or components carry the highest AI authorship density. Directories with disproportionately high scores relative to their size warrant targeted manual review: concentrated AI signatures often trace back to mass-generated configuration layers, auto-ported test suites, LLM-scaffolded boilerplate classes, or entire subsystems authored under heavy copilot assistance. Use this view to prioritise your human code-review effort.

Pattern Findings

The scanner identified 1059 distinct pattern matches across 14 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a statistically significant AI authorship indicator. 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 diagnostic confidence level (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — comment-context matches receive a ×1.5 weight because LLMs systematically over-annotate. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier as dense clusters constitute far stronger evidence of synthetic authorship than isolated hits.

Hyper-Verbose Identifiers457 hits · 396 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.py265def remove_precision_parameterized_types(expression: exp.Expr) -> exp.Expr:CODE
LOWsqlglot/transforms.py402def explode_projection_to_unnest(CODE
LOWsqlglot/transforms.py407 def _explode_projection_to_unnest(expression: exp.Expr) -> exp.Expr:CODE
LOWsqlglot/transforms.py555def add_within_group_for_percentiles(expression: exp.Expr) -> exp.Expr:CODE
LOWsqlglot/transforms.py570def remove_within_group_for_percentiles(expression: exp.Expr) -> exp.Expr:CODE
LOWsqlglot/transforms.py584def add_recursive_cte_column_names(expression: exp.Expr) -> exp.Expr:CODE
LOWsqlglot/transforms.py615def eliminate_semi_and_anti_joins(expression: exp.Expr) -> exp.Expr:CODE
LOWsqlglot/transforms.py632def eliminate_full_outer_join(expression: exp.Expr) -> exp.Expr:CODE
LOWsqlglot/transforms.py741def remove_unique_constraints(expression: exp.Expr) -> exp.Expr:CODE
LOWsqlglot/transforms.py750def ctas_with_tmp_tables_to_create_tmp_view(CODE
LOWsqlglot/transforms.py774def move_schema_columns_to_partitioned_by(expression: exp.Expr) -> exp.Expr:CODE
LOWsqlglot/transforms.py797def move_partitioned_by_to_schema_columns(expression: exp.Expr) -> exp.Expr:CODE
LOWsqlglot/transforms.py1015def inherit_struct_field_names(expression: exp.Expr) -> exp.Expr:CODE
LOWsqlglot/parser.py7146 def _parse_user_defined_function_expression(self) -> exp.Expr | None:CODE
LOWsqlglot/parser.py7149 def _parse_function_parameter(self) -> exp.Expr | None:CODE
LOWsqlglot/parser.py7152 def _parse_user_defined_function(self, kind: TokenType | None = None) -> exp.Expr | None:CODE
LOWsqlglot/parser.py108def build_extract_json_with_path(CODE
LOWsqlglot/parser.py1429 def _parse_partitioned_by_bucket_or_truncate(self) -> exp.Expr | None:CODE
LOWsqlglot/parser.py2670 def _parse_sequence_properties(self) -> exp.SequenceProperties | None:CODE
LOWsqlglot/parser.py2727 def _parse_trigger_deferrable(CODE
LOWsqlglot/parser.py2743 def _parse_trigger_referencing_clause(self, keyword: str) -> exp.Expr | None:CODE
LOWsqlglot/parser.py2751 def _parse_trigger_referencing(self) -> exp.TriggerReferencing | None:CODE
LOWsqlglot/parser.py2816 def _parse_wrapped_properties(self) -> list[exp.Expr | list[exp.Expr]]:CODE
LOWsqlglot/parser.py2841 def _parse_key_value_property(CODE
LOWsqlglot/parser.py2897 def _parse_property_assignment(self, exp_class: type[E], **kwargs: t.Any) -> E:CODE
LOWsqlglot/parser.py2937 def _parse_called_on_null_input_property(self) -> exp.CalledOnNullInputProperty | None:CODE
LOWsqlglot/parser.py2962 def _parse_system_versioning_property(CODE
LOWsqlglot/parser.py2986 def _parse_data_deletion_property(self) -> exp.DataDeletionProperty:CODE
LOWsqlglot/parser.py3002 def _parse_distributed_property(self) -> exp.DistributedByProperty:CODE
LOWsqlglot/parser.py3021 def _parse_composite_key_property(self, expr_type: type[E]) -> E:CODE
LOWsqlglot/parser.py3215 def _parse_withisolatedloading(self) -> exp.IsolatedLoadingProperty | None:CODE
LOWsqlglot/parser.py3281 def _parse_partition_bound_spec(self) -> exp.PartitionBoundSpec:CODE
LOWsqlglot/parser.py3282 def _parse_partition_bound_expr() -> exp.Expr | None:CODE
LOWsqlglot/parser.py3412 def _parse_remote_with_connection(self) -> exp.RemoteWithConnectionModelProperty:CODE
LOWsqlglot/parser.py3471 def _parse_multitable_inserts(self, comments: list[str] | None) -> exp.MultitableInserts:CODE
LOWsqlglot/parser.py4029 def _parse_recursive_with_search(self) -> exp.RecursiveWithSearch | None:CODE
LOWsqlglot/parser.py4171 def _implicit_unnests_to_explicit(self, this: E) -> E:CODE
LOWsqlglot/parser.py4244 def _parse_hint_fallback_to_string(self) -> exp.Hint | None:CODE
LOWsqlglot/parser.py4252 def _parse_hint_function_call(self) -> exp.Expr | None:CODE
LOWsqlglot/parser.py4310 def _parse_match_recognize_measure(self) -> exp.MatchRecognizeMeasure:CODE
LOWsqlglot/parser.py4482 def _parse_column_as_identifier() -> exp.Expr | None:CODE
LOWsqlglot/parser.py5063 def _parse_derived_table_values(self) -> exp.Values | None:CODE
LOWsqlglot/parser.py5202 def _parse_aliased_expression() -> exp.Expr | None:CODE
LOWsqlglot/parser.py5456 def _parse_connect_with_prior(self) -> exp.Expr | None:CODE
LOWsqlglot/parser.py5481 def _parse_name_as_expression(self) -> exp.Expr | None:CODE
LOWsqlglot/parser.py5655 def _can_parse_limit_or_offset(self) -> bool:CODE
LOWsqlglot/parser.py6550 def _parse_vector_expressions(self, expressions: list[exp.Expr]) -> list[exp.Expr]:CODE
LOWsqlglot/parser.py6738 def _parse_colon_as_variant_extract(self, this: exp.Expr | None) -> exp.Expr | None:CODE
LOWsqlglot/parser.py7129 def _parse_function_properties(self) -> exp.Properties | None:CODE
LOWsqlglot/parser.py7412 def _parse_generated_as_identity(CODE
LOWsqlglot/parser.py7508 def _parse_unnamed_constraints(self) -> list[exp.Expr]:CODE
LOWsqlglot/parser.py7518 def _parse_unnamed_constraint(self, constraints: TEXTS_TYPE | None = None) -> exp.Expr | None:CODE
LOWsqlglot/parser.py7557 def _parse_key_constraint_options(self) -> list[str]:CODE
LOWsqlglot/parser.py7638 def _parse_period_for_system_time(self) -> exp.PeriodForSystemTimeConstraint | None:CODE
LOWsqlglot/parser.py7694 def _parse_odbc_datetime_literal(self) -> exp.Expr:CODE
LOWsqlglot/parser.py8252 def _parse_open_json_column_def() -> exp.OpenJSONColumnDef:CODE
LOWsqlglot/parser.py8350 def _parse_respect_or_ignore_nulls(self, this: exp.Expr | None) -> exp.Expr | None:CODE
LOWsqlglot/parser.py8481 def _parse_partition_and_order(CODE
397 more matches not shown…
Cross-Language Confusion65 hits · 360 pts
SeverityFileLineSnippetContext
HIGHsqlglot/parser.py7222 # Fast path: simple atom (column, literal, null, bool) followed by , or )COMMENT
HIGHsqlglot/parser.py3438 return self.expression(exp.ReturnsProperty(this=value, is_table=is_table, null=null))CODE
HIGHsqlglot/parser.py8110 return self.expression(exp.OnCondition(empty=empty, error=error, null=null))CODE
HIGHsqlglot/generator.py2360 null = f" NULL DEFINED AS {null}" if null else ""CODE
HIGHsqlglot/generator.py2361 return f"ROW FORMAT DELIMITED{fields}{escaped}{items}{keys}{lines}{null}"CODE
HIGHsqlglot/generator.py5632 return f"{empty}{error}{null}"CODE
HIGHsqlglot/generators/duckdb.py3441 For BINARY: Lower to: input || REPEAT(pad, GREATEST(0, target_len - OCTET_LENGTH(input)))CODE
HIGHsqlglot/generators/duckdb.py574 DuckDB's native && operator is not NULL-safe: [1,NULL,3] && [NULL,4,5] returns FALSE.STRING
HIGHsqlglot/generators/duckdb.py577 Generated SQL: (arr1 && arr2) OR (ARRAY_LENGTH(arr1) <> LIST_COUNT(arr1) AND ARRAY_LENGTH(arr2) <> LIST_COUNT(arr2))STRING
HIGHsqlglot/generators/duckdb.py2088 WHEN LENGTH(l) < 5 THEN UNHEX(PRINTF('%04X', LENGTH(l)) || h || REPEAT('00', GREATEST(0, 4 - LENGTH(l)) * 2)STRING
HIGHsqlglot/generators/duckdb.py2094 (__a, __b) -> __a || __b, ''STRING
HIGHsqlglot/generators/duckdb.py4093 this=exp.Coalesce(this=x, expressions=[null]),STRING
HIGHtests/test_optimizer.py104 INSERT INTO x VALUES (null, null);STRING
HIGHtests/test_optimizer.py110 INSERT INTO y VALUES (null, null);STRING
HIGHtests/test_optimizer.py116 INSERT INTO y VALUES (null, null);STRING
HIGHtests/test_optimizer.py1945 "SELECT x.cola || TRIM(x.colb) AS col, DATE(x.colb), DATEFROMPARTS(y, m, d) FROM x AS x"STRING
HIGHtests/test_executor.py745 ("ARRAY_JOIN(['hello', null ,'world'], ' ', ',')", "hello , world"),CODE
HIGHtests/test_executor.py746 ("ARRAY_JOIN(['', null ,'world'], ' ', ',')", " , world"),CODE
HIGHtests/test_executor.py747 ("STRUCT('foo', 'bar', null, null)", {"foo": "bar"}),CODE
HIGHtests/test_transforms.py130 "SELECT x, t, x || t AS z FROM y QUALIFY ROW_NUMBER() OVER (PARTITION BY x ORDER BY z DESC)",CODE
HIGHtests/test_transforms.py131 "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.py111 "duckdb": "SELECT (SELECT CASE WHEN l IS NULL OR LENGTH(l) = 0 THEN NULL WHEN LENGTH(l) <> LENGTH(LIST_FCODE
HIGHtests/dialects/test_snowflake.py1240 "duckdb": "SELECT (col1 && col2) OR (ARRAY_LENGTH(col1) <> LIST_COUNT(col1) AND ARRAY_LENGTH(col2) <> LICODE
HIGHtests/dialects/test_snowflake.py1266 "ARRAY_CONSTRUCT_COMPACT(1, null, 2)",CODE
HIGHtests/dialects/test_bigquery.py2076 self.validate_identity("""JSON_STRIP_NULLS(PARSE_JSON('[1, null, 2, null, [null]]'))""")CODE
HIGHtests/dialects/test_bigquery.py2078 """JSON_STRIP_NULLS(PARSE_JSON('[1, null, 2, null]'), include_arrays => FALSE)"""STRING
HIGHtests/dialects/test_bigquery.py2081 """JSON_STRIP_NULLS(PARSE_JSON('{"a": {"b": {"c": null}}, "d": [null], "e": [], "f": 1}'), include_arrays =>STRING
HIGHtests/dialects/test_redshift.py201 'create table if not exists city_slash_id("city/id" integer not null, state char(2) not null)',CODE
HIGHtests/dialects/test_duckdb.py340 """SELECT CASE WHEN JSON_TYPE(JSON('{"a": null}') -> '$.a') = 'NULL' THEN NULL ELSE JSON('{"a": null}') -> 'STRING
HIGHtests/dialects/test_duckdb.py342 "snowflake": """SELECT STRIP_NULL_VALUE(GET_PATH(PARSE_JSON('{"a": null}'), 'a'))""",CODE
HIGHtests/dialects/test_duckdb.py546 """SELECT '{ "family": "anatidae", "species": [ "duck", "goose", "swan", null ] }' ->> ['$.family', '$.speciSTRING
HIGHtests/dialects/test_duckdb.py557 """SELECT JSON_EXTRACT_STRING('{ "family": "anatidae", "species": [ "duck", "goose", "swan", null ] }', ['$.STRING
HIGHtests/dialects/test_duckdb.py558 """SELECT '{ "family": "anatidae", "species": [ "duck", "goose", "swan", null ] }' ->> ['$.family', '$.speciSTRING
HIGHtests/dialects/test_duckdb.py1355 self.validate_identity("a && b").assert_is(exp.ArrayOverlaps)CODE
HIGHtests/dialects/test_dialect.py4965 "": """JSON_STRIP_NULLS(PARSE_JSON('[{"f1":1,"f2":null},2,null,3]'))""",CODE
HIGHtests/dialects/test_dialect.py4966 "bigquery": """JSON_STRIP_NULLS(PARSE_JSON('[{"f1":1,"f2":null},2,null,3]'))""",CODE
HIGHtests/dialects/test_dialect.py4969 "bigquery": """JSON_STRIP_NULLS(PARSE_JSON('[{"f1":1,"f2":null},2,null,3]'))""",CODE
HIGHtests/dialects/test_dialect.py4970 "postgres": """JSON_STRIP_NULLS(CAST('[{"f1":1,"f2":null},2,null,3]' AS JSON))""",CODE
HIGHtests/dialects/test_dialect.py2218 "redshift": "a || b || c",CODE
HIGHtests/dialects/test_dialect.py2219 "sqlite": "a || b || c",CODE
HIGHtests/dialects/test_dialect.py4963 """JSON_STRIP_NULLS(PARSE_JSON('[{"f1":1,"f2":null},2,null,3]'))""",STRING
HIGHtests/dialects/test_mysql.py294 self.validate_identity("SELECT 1 && 0", "SELECT 1 AND 0")CODE
HIGHtests/dialects/test_mysql.py315 self.validate_identity("SELECT a || b", "SELECT a OR b")CODE
HIGHtests/dialects/test_mysql.py1145 "sqlite": "GROUP_CONCAT(a || b || c, ',')",CODE
HIGHtests/dialects/test_mysql.py1147 "postgres": "STRING_AGG(a || b || c, ',')",CODE
HIGHtests/dialects/test_mysql.py1156 "sqlite": "GROUP_CONCAT(a || b || c, '')",CODE
HIGHtests/dialects/test_mysql.py1159 "postgres": "STRING_AGG(a || b || c, '')",CODE
HIGHtests/dialects/test_mysql.py1166 "sqlite": "GROUP_CONCAT(DISTINCT a || b || c, '')",CODE
HIGHtests/dialects/test_mysql.py1169 "postgres": "STRING_AGG(DISTINCT a || b || c, '')",CODE
HIGHtests/dialects/test_mysql.py1176 "sqlite": "GROUP_CONCAT(a || b || c, '')",CODE
HIGHtests/dialects/test_mysql.py1179 "postgres": "STRING_AGG(a || b || c, '' ORDER BY d NULLS FIRST)",CODE
HIGHtests/dialects/test_mysql.py1186 "sqlite": "GROUP_CONCAT(DISTINCT a || b || c, '')",CODE
HIGHtests/dialects/test_mysql.py1189 "postgres": "STRING_AGG(DISTINCT a || b || c, '' ORDER BY d NULLS FIRST)",CODE
HIGHtests/dialects/test_solr.py12 self.validate_identity("a || b", "a OR b").assert_is(exp.Or)CODE
HIGHtests/dialects/test_prql.py81 "from x filter (age > 25 && age < 27)",CODE
HIGHtests/dialects/test_prql.py85 "from x filter (age > 25 || age < 27)",CODE
HIGHtests/dialects/test_prql.py89 "from x filter (age > 25 || age < 22) filter age > 26 filter age < 27",CODE
HIGHtests/dialects/test_prql.py141 "from x filter (a > 1 || null != b || c != null)",CODE
HIGHtests/dialects/test_prql.py141 "from x filter (a > 1 || null != b || c != null)",CODE
HIGHtests/dialects/test_clickhouse.py489 "postgres": "a || b",CODE
5 more matches not shown…
Unused Imports254 hits · 239 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/lineage.py1CODE
LOWsqlglot/__main__.py1CODE
LOWsqlglot/jsonpath.py1CODE
LOWsqlglot/schema.py1CODE
LOWsqlglot/parsers/redshift.py1CODE
194 more matches not shown…
Deep Nesting188 hits · 156 pts
SeverityFileLineSnippetContext
LOWsqlglot/planner.py46CODE
LOWsqlglot/transforms.py201CODE
LOWsqlglot/transforms.py278CODE
LOWsqlglot/transforms.py297CODE
LOWsqlglot/transforms.py402CODE
LOWsqlglot/transforms.py584CODE
LOWsqlglot/transforms.py615CODE
LOWsqlglot/transforms.py836CODE
LOWsqlglot/transforms.py1015CODE
LOWsqlglot/transforms.py407CODE
LOWsqlglot/serde.py23CODE
LOWsqlglot/tokenizer_core.py681CODE
LOWsqlglot/tokenizer_core.py804CODE
LOWsqlglot/tokenizer_core.py864CODE
LOWsqlglot/tokenizer_core.py922CODE
LOWsqlglot/tokenizer_core.py1036CODE
LOWsqlglot/tokenizer_core.py1124CODE
LOWsqlglot/parser.py2384CODE
LOWsqlglot/parser.py2670CODE
LOWsqlglot/parser.py2751CODE
LOWsqlglot/parser.py2962CODE
LOWsqlglot/parser.py2986CODE
LOWsqlglot/parser.py3229CODE
LOWsqlglot/parser.py3730CODE
LOWsqlglot/parser.py3829CODE
LOWsqlglot/parser.py3887CODE
LOWsqlglot/parser.py4171CODE
LOWsqlglot/parser.py4204CODE
LOWsqlglot/parser.py4318CODE
LOWsqlglot/parser.py4490CODE
LOWsqlglot/parser.py4696CODE
LOWsqlglot/parser.py4830CODE
LOWsqlglot/parser.py5238CODE
LOWsqlglot/parser.py5372CODE
LOWsqlglot/parser.py5573CODE
LOWsqlglot/parser.py5692CODE
LOWsqlglot/parser.py5793CODE
LOWsqlglot/parser.py5882CODE
LOWsqlglot/parser.py5959CODE
LOWsqlglot/parser.py6094CODE
LOWsqlglot/parser.py6127CODE
LOWsqlglot/parser.py6269CODE
LOWsqlglot/parser.py6631CODE
LOWsqlglot/parser.py6738CODE
LOWsqlglot/parser.py6798CODE
LOWsqlglot/parser.py6866CODE
LOWsqlglot/parser.py6904CODE
LOWsqlglot/parser.py6982CODE
LOWsqlglot/parser.py7360CODE
LOWsqlglot/parser.py7557CODE
LOWsqlglot/parser.py7889CODE
LOWsqlglot/parser.py8292CODE
LOWsqlglot/parser.py8911CODE
LOWsqlglot/parser.py9011CODE
LOWsqlglot/parser.py9110CODE
LOWsqlglot/parser.py9149CODE
LOWsqlglot/parser.py9209CODE
LOWsqlglot/parser.py9474CODE
LOWsqlglot/parser.py9589CODE
LOWsqlglot/generator.py2172CODE
128 more matches not shown…
Docstring Block Structure20 hits · 100 pts
SeverityFileLineSnippetContext
HIGHsqlglot/time.py20 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.py31 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.py632 Traverse an expression by its "scopes". "Scope" represents the current context of a Select statement. ThiSTRING
HIGHsqlglot/expressions/builders.py752Get the full name of a table as a string. Args: table: Table expression node or string. dialect: ThSTRING
HIGHsqlglot/expressions/builders.py810Replace all tables in expression according to the mapping. Args: expression: expression node to be transforSTRING
HIGHsqlglot/expressions/builders.py848Replace placeholders in an expression. Args: expression: expression node to be transformed and replaced. STRING
HIGHsqlglot/expressions/builders.py889Transforms an expression by expanding all referenced sources into subqueries. Examples: >>> from sqlglot imSTRING
HIGHsqlglot/expressions/builders.py932 Returns a Func expression. Examples: >>> func("abs", 5).sql() 'ABS(5)' >>> func("castSTRING
HIGHsqlglot/expressions/builders.py1025 Returns an array. Examples: >>> array(1, 'x').sql() 'ARRAY(1, x)' Args: expressioSTRING
HIGHsqlglot/expressions/builders.py1055 Returns an tuple. Examples: >>> tuple_(1, 'x').sql() '(1, x)' Args: expressions: STRING
HIGHsqlglot/expressions/query.py273 Append to or set the WHERE expressions. Examples: >>> Select().select("x").from_("tbl").whSTRING
HIGHsqlglot/expressions/query.py1601 Set the locking read mode for this expression. Examples: >>> Select().select("x").from_("tSTRING
HIGHsqlglot/expressions/query.py1624 Set hints for this expression. Examples: >>> Select().select("x").from_("tbl").hint("BROADSTRING
HIGHsqlglot/generators/duckdb.py909 Compute the Monday-based day shift to align DATE_DIFF('WEEK', ...) coming from other dialects, e.g BigQuery's WSTRING
Hallucination Indicators2 hits · 25 pts
SeverityFileLineSnippetContext
CRITICALsqlglot/generator.py5275 converted_style = sqlglot.dialects.tsql.TSQL.CONVERT_FORMAT_MAPPING.get(style_value)CODE
CRITICALtests/test_parser.py1157 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.py665 # Check if this is ML.TRANSLATE by looking at previous tokensCOMMENT
LOWsqlglot/parsers/bigquery.py673 # Check if this is ML.FORECAST by looking at previous tokens.COMMENT
LOWsqlglot/optimizer/qualify_columns.py740 # Check if current rhs identifier is in structCOMMENT
LOWsqlglot/dialects/dialect.py1511 # Check if ANY argument is NULL and return NULL explicitlyCOMMENT
LOWsqlglot/dialects/dialect.py1591 # Check if both are last day of monthCOMMENT
LOWsqlglot/generators/fabric.py79 # Check if this is a temporal type that needs precision handling. Fabric limits temporalCOMMENT
LOWsqlglot/generators/snowflake.py694 # Check if this is a FLOAT type nested inside a VECTOR typeCOMMENT
LOWsqlglot/generators/snowflake.py1131 # Set part_index to 1 if missingCOMMENT
LOWsqlglot/generators/duckdb.py858 # Check if we need NTZ (naive timestamp in UTC)COMMENT
LOWsqlglot/generators/duckdb.py2340 # Check if we need the end of the slice (default is start)STRING
LOWsqlglot/generators/duckdb.py2746 # Check if target_type requires TIMESTAMPTZ (for LTZ/TZ variants)STRING
LOWsqlglot/generators/duckdb.py2962 # Check if values are within normal ranges - use MAKE_TIME for efficiencySTRING
LOWsqlglot/generators/duckdb.py3062 # Check if this is the date/time expression form: TIMESTAMP_FROM_PARTS(date_expr, time_expr)STRING
LOWsqlglot/generators/duckdb.py3731 # Check if it's a text type (handles both literals and annotated expressions)STRING
LOWsqlglot/generators/duckdb.py3744 # Check if input is a string type - ENCODE only accepts VARCHARSTRING
LOWsqlglot/generators/starrocks.py303 # 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
Self-Referential Comments6 hits · 16 pts
SeverityFileLineSnippetContext
MEDIUMsqlglot/lineage.py319 # Create the node for this step in the lineage chain, and attach it to the previous one.COMMENT
MEDIUMsqlglot/expressions/builders.py916 # Create a subquery with the same alias (or table name if no alias)COMMENT
MEDIUMsqlglot/generators/fabric.py82 # Create a new expression with the capped precisionCOMMENT
MEDIUMsqlglot/generators/fabric.py141 # Create the base datetime as '1970-01-01' cast to DATETIME2(6)COMMENT
MEDIUMsqlglot/generators/duckdb.py3895 # 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
AI Slop Vocabulary7 hits · 14 pts
SeverityFileLineSnippetContext
LOWsetup.py11 # for py3.10+; on py3.9 just use upstream mypy for type checking.COMMENT
MEDIUMsqlglot/parser.py6234 # DECIMAL(38, 0)) in order to facilitate the data type's transpilation.COMMENT
MEDIUMsqlglot/generator.py408 # Whether JOIN sides (LEFT, RIGHT) are supported in conjunction with SEMI/ANTI join kindsCOMMENT
MEDIUMsqlglot/generators/snowflake.py343 # This transformation is used to facilitate transpilation of BigQuery `UNNEST` operationsCOMMENT
LOWsqlglot/generators/duckdb.py3145 # DuckDB doesn't, but we can just add a dummy ON clause that is always trueSTRING
LOWsqlglot/generators/duckdb.py3725 # Default DuckDB behavior - just return RANDOM() as floatSTRING
MEDIUMtests/leakcheck.py337 # harness that runs the suite multiple times. ``setdefault`` lets theCOMMENT
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.py673 except Exception as e:CODE
LOWsqlglot/tokenizer_core.py1091 except Exception:CODE
LOWsqlglot/expressions/core.py1750 except Exception:CODE
LOWsqlglot/executor/python.py58 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.py1416 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
LOWtests/dialects/test_spark.py717 "SELECT RLIKE('John Doe', 'John.*')",CODE
LOWtests/dialects/test_spark.py719 "bigquery": "SELECT REGEXP_CONTAINS('John Doe', 'John.*')",CODE
LOWtests/dialects/test_spark.py720 "hive": "SELECT 'John Doe' RLIKE 'John.*'",CODE
LOWtests/dialects/test_spark.py721 "postgres": "SELECT 'John Doe' ~ 'John.*'",CODE
LOWtests/dialects/test_spark.py722 "snowflake": "SELECT REGEXP_LIKE('John Doe', 'John.*')",CODE
LOWtests/dialects/test_spark.py723 "spark": "SELECT 'John Doe' RLIKE 'John.*'",CODE
LOWtests/dialects/test_postgres.py1034 "SELECT PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY a) FILTER(WHERE CAST(b AS BOOLEAN)) AS mean_value FROM (CODE
Over-Commented Block11 hits · 10 pts
SeverityFileLineSnippetContext
LOWposts/ast_primer.md21# expressions=[COMMENT
LOWposts/ast_primer.md261# x.a AS a,COMMENT
LOWsqlglot/parser.py1841COMMENT
LOWsqlglot/parser.py6221 data_type = exp.DType.TIMESTAMPTZ.into_expr()COMMENT
LOWsqlglot/parser.py8381 exp.Filter(this=this, expression=self._parse_where(skip_where_token=True))COMMENT
LOWsqlglot/expressions/properties.py621 # CREATE property locationsCOMMENT
LOWsqlglot/generators/clickhouse.py521 # String is the standard ClickHouse type, every other variant is just an alias.COMMENT
LOWsqlglot/generators/duckdb.py2041 #COMMENT
LOWsqlglot/generators/duckdb.py2061 #COMMENT
LOWsqlglot/generators/duckdb.py2261 #COMMENT
LOWsqlglot/generators/duckdb.py2281 #COMMENT
Modern Structural Boilerplate7 hits · 8 pts
SeverityFileLineSnippetContext
LOWsqlglot/planner.py146 def set_ops_and_aggs(step) -> None:CODE
LOWsqlglot/optimizer/qualify_columns.py202 def _update_source_columns(source_name: str) -> None:CODE
LOWsqlglot/expressions/core.py290 def _set_parent(self, arg_key: str, value: object, index: int | None = None) -> None:CODE
LOWsqlglot/expressions/core.py1116 def _set_parent(self, arg_key: str, value: object, index: int | None = None) -> None:CODE
LOWsqlglot/executor/context.py85 def set_row(self, row: tuple) -> None:CODE
LOWsqlglot/executor/context.py90 def set_index(self, index: int) -> None:CODE
LOWsqlglot/executor/context.py95 def set_range(self, start: int, end: int) -> None:CODE
AI Structural Patterns6 hits · 4 pts
SeverityFileLineSnippetContext
LOWsqlglot/generator.py867CODE
LOWsqlglot/generator.py4669CODE
LOWsqlglot/generator.py5604CODE
LOWsqlglot/lineage.py196CODE
LOWsqlglot/optimizer/qualify.py19CODE
LOWsqlglot/generators/athena.py133CODE