Repository Analysis

tobymao/sqlglot

Python SQL Parser and Transpiler

11.5 Low AI signal View on GitHub

Analysis Overview

This report presents the forensic synthetic code analysis of tobymao/sqlglot, a Python project with 9,577 GitHub stars. SynthScan v2.0 examined 143,155 lines of code across 273 source files, recording 1192 pattern matches distributed across 14 syntactic categories. The overall adjusted score of 11.5 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).

11.5
Adjusted Score
11.5
Raw Score
100%
Time Factor
2026-08-28
Last Push
9.6K
Stars
Python
Language
143.2K
Lines of Code
273
Files
1.2K
Pattern Hits
2026-08-29
Scan Date
0.41
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 111MEDIUM 12LOW 1067

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 1192 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.

Cross-Language Confusion91 hits · 550 pts
SeverityFileLineSnippetContext
HIGHsqlglot/parser.py7469 # Fast path: simple atom (column, literal, null, bool) followed by , or )COMMENT
HIGHsqlglot/parser.py3524 return self.expression(exp.ReturnsProperty(this=value, is_table=is_table, null=null))CODE
HIGHsqlglot/parser.py8383 return self.expression(exp.OnCondition(empty=empty, error=error, null=null))CODE
HIGHsqlglot/generator.py2389 null = f" NULL DEFINED AS {null}" if null else ""CODE
HIGHsqlglot/generator.py2390 return f"ROW FORMAT DELIMITED{fields}{escaped}{items}{keys}{lines}{null}"CODE
HIGHsqlglot/generator.py5696 return f"{empty}{error}{null}"CODE
HIGHsqlglot/generators/duckdb.py3442 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.py2067 WHEN LENGTH(l) < 5 THEN UNHEX(PRINTF('%04X', LENGTH(l)) || h || REPEAT('00', GREATEST(0, 4 - LENGTH(l)) * 2)STRING
HIGHsqlglot/generators/duckdb.py2073 (__a, __b) -> __a || __b, ''STRING
HIGHsqlglot/generators/duckdb.py4125 this=exp.Coalesce(this=x, expressions=[null]),STRING
HIGHtests/test_optimizer.py105 INSERT INTO x VALUES (null, null);STRING
HIGHtests/test_optimizer.py111 INSERT INTO y VALUES (null, null);STRING
HIGHtests/test_optimizer.py117 INSERT INTO y VALUES (null, null);STRING
HIGHtests/test_optimizer.py2609 "SELECT x.cola || TRIM(x.colb) AS col, DATE(x.colb), DATEFROMPARTS(y, m, d) FROM x AS x"STRING
HIGHtests/test_executor.py991 ("a || b", "xy"),CODE
HIGHtests/test_executor.py992 ("a || b || a", "xyx"),CODE
HIGHtests/test_executor.py993 ("a || n", "x1"),CODE
HIGHtests/test_executor.py994 ("n || a", "1x"),CODE
HIGHtests/test_executor.py995 ("a || nul", None),CODE
HIGHtests/test_executor.py996 ("nul || a", None),CODE
HIGHtests/test_executor.py997 ("arr || arr", [1, 2, 1, 2]),CODE
HIGHtests/test_executor.py998 ("arr || n", [1, 2, 1]),CODE
HIGHtests/test_executor.py999 ("n || arr", [1, 1, 2]),CODE
HIGHtests/test_executor.py1000 ("arr || nul", None),CODE
HIGHtests/test_executor.py1011 rows = execute("SELECT a || n FROM t", tables=tables, dialect="postgres").rowsCODE
HIGHtests/test_executor.py1015 execute("SELECT a || n FROM t", tables=tables, dialect="trino")CODE
HIGHtests/test_executor.py1223 ("ARRAY_JOIN(['hello', null ,'world'], ' ', ',')", "hello , world"),CODE
HIGHtests/test_executor.py1224 ("ARRAY_JOIN(['', null ,'world'], ' ', ',')", " , world"),CODE
HIGHtests/test_executor.py1225 ("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.py122 "duckdb": "SELECT (SELECT CASE WHEN l IS NULL OR LENGTH(l) = 0 THEN NULL WHEN LENGTH(l) <> LENGTH(LIST_FCODE
HIGHtests/dialects/test_snowflake.py1284 "duckdb": "SELECT (col1 && col2) OR (ARRAY_LENGTH(col1) <> LIST_COUNT(col1) AND ARRAY_LENGTH(col2) <> LICODE
HIGHtests/dialects/test_snowflake.py1310 "ARRAY_CONSTRUCT_COMPACT(1, null, 2)",CODE
HIGHtests/dialects/test_bigquery.py2143 self.validate_identity("""JSON_STRIP_NULLS(PARSE_JSON('[1, null, 2, null, [null]]'))""")CODE
HIGHtests/dialects/test_bigquery.py2145 """JSON_STRIP_NULLS(PARSE_JSON('[1, null, 2, null]'), include_arrays => FALSE)"""STRING
HIGHtests/dialects/test_bigquery.py2148 """JSON_STRIP_NULLS(PARSE_JSON('{"a": {"b": {"c": null}}, "d": [null], "e": [], "f": 1}'), include_arrays =>STRING
HIGHtests/dialects/test_redshift.py207 '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.py1431 self.validate_identity("a && b").assert_is(exp.ArrayOverlaps)CODE
HIGHtests/dialects/test_dialect.py4997 "": """JSON_STRIP_NULLS(PARSE_JSON('[{"f1":1,"f2":null},2,null,3]'))""",CODE
HIGHtests/dialects/test_dialect.py4998 "bigquery": """JSON_STRIP_NULLS(PARSE_JSON('[{"f1":1,"f2":null},2,null,3]'))""",CODE
HIGHtests/dialects/test_dialect.py5001 "bigquery": """JSON_STRIP_NULLS(PARSE_JSON('[{"f1":1,"f2":null},2,null,3]'))""",CODE
HIGHtests/dialects/test_dialect.py5002 "postgres": """JSON_STRIP_NULLS(CAST('[{"f1":1,"f2":null},2,null,3]' AS JSON))""",CODE
HIGHtests/dialects/test_dialect.py2224 "redshift": "a || b || c",CODE
HIGHtests/dialects/test_dialect.py2225 "sqlite": "a || b || c",CODE
HIGHtests/dialects/test_dialect.py4995 """JSON_STRIP_NULLS(PARSE_JSON('[{"f1":1,"f2":null},2,null,3]'))""",STRING
HIGHtests/dialects/test_mysql.py324 self.validate_identity("SELECT 1 && 0", "SELECT 1 AND 0")CODE
HIGHtests/dialects/test_mysql.py345 self.validate_identity("SELECT a || b", "SELECT a OR b")CODE
HIGHtests/dialects/test_mysql.py1199 "sqlite": "GROUP_CONCAT(a || b || c, ',')",CODE
HIGHtests/dialects/test_mysql.py1201 "postgres": "STRING_AGG(a || b || c, ',')",CODE
HIGHtests/dialects/test_mysql.py1210 "sqlite": "GROUP_CONCAT(a || b || c, '')",CODE
HIGHtests/dialects/test_mysql.py1213 "postgres": "STRING_AGG(a || b || c, '')",CODE
HIGHtests/dialects/test_mysql.py1220 "sqlite": "GROUP_CONCAT(DISTINCT a || b || c, '')",CODE
31 more matches not shown…
Hyper-Verbose Identifiers547 hits · 467 pts
SeverityFileLineSnippetContext
LOWsqlglotc/setup.py101 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.py408 def _explode_projection_to_unnest(expression: exp.Expr) -> exp.Expr:CODE
LOWsqlglot/transforms.py596def add_within_group_for_percentiles(expression: exp.Expr) -> exp.Expr:CODE
LOWsqlglot/transforms.py611def remove_within_group_for_percentiles(expression: exp.Expr) -> exp.Expr:CODE
LOWsqlglot/transforms.py625def add_recursive_cte_column_names(expression: exp.Expr) -> exp.Expr:CODE
LOWsqlglot/transforms.py656def eliminate_semi_and_anti_joins(expression: exp.Expr) -> exp.Expr:CODE
LOWsqlglot/transforms.py673def eliminate_full_outer_join(expression: exp.Expr) -> exp.Expr:CODE
LOWsqlglot/transforms.py799def remove_unique_constraints(expression: exp.Expr) -> exp.Expr:CODE
LOWsqlglot/transforms.py808def ctas_with_tmp_tables_to_create_tmp_view(CODE
LOWsqlglot/transforms.py832def move_schema_columns_to_partitioned_by(expression: exp.Expr) -> exp.Expr:CODE
LOWsqlglot/transforms.py855def move_partitioned_by_to_schema_columns(expression: exp.Expr) -> exp.Expr:CODE
LOWsqlglot/transforms.py1073def inherit_struct_field_names(expression: exp.Expr) -> exp.Expr:CODE
LOWsqlglot/parser.py7393 def _parse_user_defined_function_expression(self) -> exp.Expr | None:CODE
LOWsqlglot/parser.py7396 def _parse_function_parameter(self) -> exp.Expr | None:CODE
LOWsqlglot/parser.py7399 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.py305def build_json_extract_scalar(CODE
LOWsqlglot/parser.py322def build_jsonb_extract_scalar(CODE
LOWsqlglot/parser.py328def build_jsonb_contains_top_key(CODE
LOWsqlglot/parser.py1480 def _parse_partitioned_by_bucket_or_truncate(self) -> exp.Expr | None:CODE
LOWsqlglot/parser.py2745 def _parse_sequence_properties(self) -> exp.SequenceProperties | None:CODE
LOWsqlglot/parser.py2803 def _parse_trigger_deferrable(CODE
LOWsqlglot/parser.py2819 def _parse_trigger_referencing_clause(self, keyword: str) -> exp.Expr | None:CODE
LOWsqlglot/parser.py2827 def _parse_trigger_referencing(self) -> exp.TriggerReferencing | None:CODE
LOWsqlglot/parser.py2895 def _parse_wrapped_properties(self) -> list[exp.Expr | list[exp.Expr]]:CODE
LOWsqlglot/parser.py2927 def _parse_key_value_property(CODE
LOWsqlglot/parser.py2983 def _parse_property_assignment(self, exp_class: type[E], **kwargs: t.Any) -> E:CODE
LOWsqlglot/parser.py3023 def _parse_called_on_null_input_property(self) -> exp.CalledOnNullInputProperty | None:CODE
LOWsqlglot/parser.py3048 def _parse_system_versioning_property(CODE
LOWsqlglot/parser.py3072 def _parse_data_deletion_property(self) -> exp.DataDeletionProperty:CODE
LOWsqlglot/parser.py3088 def _parse_distributed_property(self) -> exp.DistributedByProperty:CODE
LOWsqlglot/parser.py3107 def _parse_composite_key_property(self, expr_type: type[E]) -> E:CODE
LOWsqlglot/parser.py3301 def _parse_withisolatedloading(self) -> exp.IsolatedLoadingProperty | None:CODE
LOWsqlglot/parser.py3367 def _parse_partition_bound_spec(self) -> exp.PartitionBoundSpec:CODE
LOWsqlglot/parser.py3368 def _parse_partition_bound_expr() -> exp.Expr | None:CODE
LOWsqlglot/parser.py3498 def _parse_remote_with_connection(self) -> exp.RemoteWithConnectionModelProperty:CODE
LOWsqlglot/parser.py3557 def _parse_multitable_inserts(self, comments: list[str] | None) -> exp.MultitableInserts:CODE
LOWsqlglot/parser.py4161 def _parse_recursive_with_search(self) -> exp.RecursiveWithSearch | None:CODE
LOWsqlglot/parser.py4317 def _implicit_unnests_to_explicit(self, this: E) -> E:CODE
LOWsqlglot/parser.py4402 def _parse_hint_fallback_to_string(self) -> exp.Hint | None:CODE
LOWsqlglot/parser.py4410 def _parse_hint_function_call(self) -> exp.Expr | None:CODE
LOWsqlglot/parser.py4468 def _parse_match_recognize_measure(self) -> exp.MatchRecognizeMeasure:CODE
LOWsqlglot/parser.py4644 def _parse_column_as_identifier() -> exp.Expr | None:CODE
LOWsqlglot/parser.py5239 def _parse_derived_table_values(self) -> exp.Values | None:CODE
LOWsqlglot/parser.py5378 def _parse_aliased_expression() -> exp.Expr | None:CODE
LOWsqlglot/parser.py5638 def _parse_connect_with_prior(self) -> exp.Expr | None:CODE
LOWsqlglot/parser.py5663 def _parse_name_as_expression(self) -> exp.Expr | None:CODE
LOWsqlglot/parser.py5828 def _can_parse_limit_or_offset(self) -> bool:CODE
LOWsqlglot/parser.py6770 def _parse_vector_expressions(self, expressions: list[exp.Expr]) -> list[exp.Expr]:CODE
LOWsqlglot/parser.py6958 def _parse_colon_as_variant_extract(self, this: exp.Expr | None) -> exp.Expr | None:CODE
LOWsqlglot/parser.py7216 def _parse_connector_function(self, connector: t.Callable[..., exp.Condition]) -> exp.Paren:CODE
LOWsqlglot/parser.py7371 def _parse_function_properties(self) -> exp.Properties | None:CODE
LOWsqlglot/parser.py7673 def _parse_generated_as_identity(CODE
LOWsqlglot/parser.py7779 def _parse_unnamed_constraints(self) -> list[exp.Expr]:CODE
LOWsqlglot/parser.py7789 def _parse_unnamed_constraint(self, constraints: TEXTS_TYPE | None = None) -> exp.Expr | None:CODE
LOWsqlglot/parser.py7828 def _parse_key_constraint_options(self) -> list[str]:CODE
LOWsqlglot/parser.py7909 def _parse_period_for_system_time(self) -> exp.PeriodForSystemTimeConstraint | None:CODE
487 more matches not shown…
Unused Imports259 hits · 244 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
199 more matches not shown…
Deep Nesting199 hits · 164 pts
SeverityFileLineSnippetContext
LOWsqlglot/planner.py49CODE
LOWsqlglot/transforms.py201CODE
LOWsqlglot/transforms.py278CODE
LOWsqlglot/transforms.py297CODE
LOWsqlglot/transforms.py402CODE
LOWsqlglot/transforms.py625CODE
LOWsqlglot/transforms.py656CODE
LOWsqlglot/transforms.py894CODE
LOWsqlglot/transforms.py1073CODE
LOWsqlglot/transforms.py408CODE
LOWsqlglot/serde.py23CODE
LOWsqlglot/tokenizer_core.py679CODE
LOWsqlglot/tokenizer_core.py802CODE
LOWsqlglot/tokenizer_core.py862CODE
LOWsqlglot/tokenizer_core.py920CODE
LOWsqlglot/tokenizer_core.py1034CODE
LOWsqlglot/tokenizer_core.py1122CODE
LOWsqlglot/parser.py2459CODE
LOWsqlglot/parser.py2745CODE
LOWsqlglot/parser.py2827CODE
LOWsqlglot/parser.py3048CODE
LOWsqlglot/parser.py3072CODE
LOWsqlglot/parser.py3315CODE
LOWsqlglot/parser.py3862CODE
LOWsqlglot/parser.py3961CODE
LOWsqlglot/parser.py4019CODE
LOWsqlglot/parser.py4317CODE
LOWsqlglot/parser.py4350CODE
LOWsqlglot/parser.py4476CODE
LOWsqlglot/parser.py4652CODE
LOWsqlglot/parser.py4858CODE
LOWsqlglot/parser.py4992CODE
LOWsqlglot/parser.py5414CODE
LOWsqlglot/parser.py5554CODE
LOWsqlglot/parser.py5865CODE
LOWsqlglot/parser.py5979CODE
LOWsqlglot/parser.py6068CODE
LOWsqlglot/parser.py6152CODE
LOWsqlglot/parser.py6303CODE
LOWsqlglot/parser.py6406CODE
LOWsqlglot/parser.py6489CODE
LOWsqlglot/parser.py6851CODE
LOWsqlglot/parser.py6958CODE
LOWsqlglot/parser.py7018CODE
LOWsqlglot/parser.py7086CODE
LOWsqlglot/parser.py7124CODE
LOWsqlglot/parser.py7224CODE
LOWsqlglot/parser.py7530CODE
LOWsqlglot/parser.py7615CODE
LOWsqlglot/parser.py7828CODE
LOWsqlglot/parser.py8160CODE
LOWsqlglot/parser.py8565CODE
LOWsqlglot/parser.py9209CODE
LOWsqlglot/parser.py9309CODE
LOWsqlglot/parser.py9410CODE
LOWsqlglot/parser.py9449CODE
LOWsqlglot/parser.py9509CODE
LOWsqlglot/parser.py9774CODE
LOWsqlglot/parser.py9889CODE
LOWsqlglot/generator.py2199CODE
139 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.py648 Traverse an expression by its "scopes". "Scope" represents the current context of a Select statement. ThiSTRING
HIGHsqlglot/dialects/dialect.py2141 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.py273 Append to or set the WHERE expressions. Examples: >>> Select().select("x").from_("tbl").whSTRING
HIGHsqlglot/expressions/query.py1606 Set the locking read mode for this expression. Examples: >>> Select().select("x").from_("tSTRING
HIGHsqlglot/expressions/query.py1629 Set hints for this expression. Examples: >>> Select().select("x").from_("tbl").hint("BROADSTRING
Hallucination Indicators2 hits · 25 pts
SeverityFileLineSnippetContext
CRITICALsqlglot/generator.py5337 converted_style = sqlglot.dialects.tsql.TSQL.CONVERT_FORMAT_MAPPING.get(style_value)CODE
CRITICALtests/test_parser.py1207 sql = "a.b.c.d.e.f.g.foo()"CODE
Redundant / Tautological Comments18 hits · 20 pts
SeverityFileLineSnippetContext
LOWsqlglotc/setup.py83# Set MYPYPATH to the parent of the sqlglot source so mypy resolvesCOMMENT
LOWsqlglot/parsers/bigquery.py686 # Check if this is ML.TRANSLATE by looking at previous tokensCOMMENT
LOWsqlglot/parsers/bigquery.py694 # Check if this is ML.FORECAST by looking at previous tokens.COMMENT
LOWsqlglot/optimizer/qualify_columns.py915 # Check if current rhs identifier is in structCOMMENT
LOWsqlglot/dialects/dialect.py1516 # Check if ANY argument is NULL and return NULL explicitlyCOMMENT
LOWsqlglot/dialects/dialect.py1596 # 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.py682 # Check if this is a FLOAT type nested inside a VECTOR typeCOMMENT
LOWsqlglot/generators/snowflake.py1119 # Set part_index to 1 if missingCOMMENT
LOWsqlglot/generators/duckdb.py853 # Check if we need NTZ (naive timestamp in UTC)COMMENT
LOWsqlglot/generators/duckdb.py2338 # Check if we need the end of the slice (default is start)STRING
LOWsqlglot/generators/duckdb.py2737 # Check if target_type requires TIMESTAMPTZ (for LTZ/TZ variants)STRING
LOWsqlglot/generators/duckdb.py2953 # Check if values are within normal ranges - use MAKE_TIME for efficiencySTRING
LOWsqlglot/generators/duckdb.py3053 # Check if this is the date/time expression form: TIMESTAMP_FROM_PARTS(date_expr, time_expr)STRING
LOWsqlglot/generators/duckdb.py3749 # Check if it's a text type (handles both literals and annotated expressions)STRING
LOWsqlglot/generators/duckdb.py3762 # Check if input is a string type - ENCODE only accepts VARCHARSTRING
LOWsqlglot/generators/starrocks.py308 # 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.py6454 # DECIMAL(38, 0)) in order to facilitate the data type's transpilation.COMMENT
MEDIUMsqlglot/generator.py411 # Whether JOIN sides (LEFT, RIGHT) are supported in conjunction with SEMI/ANTI join kindsCOMMENT
MEDIUMsqlglot/generators/snowflake.py344 # This transformation is used to facilitate transpilation of BigQuery `UNNEST` operationsCOMMENT
LOWsqlglot/generators/duckdb.py3146 # DuckDB doesn't, but we can just add a dummy ON clause that is always trueSTRING
LOWsqlglot/generators/duckdb.py3743 # Default DuckDB behavior - just return RANDOM() as floatSTRING
MEDIUMtests/leakcheck.py337 # 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.py319 # 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.py3913 # 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.py159 except Exception as e:CODE
LOWpdoc/cli.py21 except Exception:CODE
LOWsqlglot/tokenizer_core.py671 except Exception as e:CODE
LOWsqlglot/tokenizer_core.py1089 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.py1395 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.py772 "SELECT RLIKE('John Doe', 'John.*')",CODE
LOWtests/dialects/test_spark.py774 "bigquery": "SELECT REGEXP_CONTAINS('John Doe', 'John.*')",CODE
LOWtests/dialects/test_spark.py775 "hive": "SELECT 'John Doe' RLIKE 'John.*'",CODE
LOWtests/dialects/test_spark.py776 "postgres": "SELECT 'John Doe' ~ 'John.*'",CODE
LOWtests/dialects/test_spark.py777 "snowflake": "SELECT REGEXP_LIKE('John Doe', 'John.*')",CODE
LOWtests/dialects/test_spark.py778 "spark": "SELECT 'John Doe' RLIKE 'John.*'",CODE
LOWtests/dialects/test_postgres.py1064 "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.py1921 # Whether map literals support arbitrary expressions as keys.COMMENT
LOWsqlglot/parser.py6441 data_type = exp.DType.TIMETZ.into_expr()COMMENT
LOWsqlglot/parser.py8661 exp.Filter(this=this, expression=self._parse_where(skip_where_token=True))COMMENT
LOWsqlglot/parsers/bigquery.py481 table.meta["quoted_table"] = TrueCOMMENT
LOWsqlglot/expressions/properties.py621 "ROW_FORMAT": RowFormatProperty,COMMENT
LOWsqlglot/generators/clickhouse.py521 # String is the standard ClickHouse type, every other variant is just an alias.COMMENT
LOWsqlglot/generators/duckdb.py2021 # BACKGROUND:COMMENT
LOWsqlglot/generators/duckdb.py2041 # TEMPLATE STRUCTURECOMMENT
LOWsqlglot/generators/duckdb.py2261 # WHEN delimiter = '' AND index = 1 THEN input_strCOMMENT
Modern Structural Boilerplate7 hits · 8 pts
SeverityFileLineSnippetContext
LOWsqlglot/planner.py149 def set_ops_and_aggs(step) -> None:CODE
LOWsqlglot/optimizer/qualify_columns.py212 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
LOWsqlglot/executor/context.py96 def set_row(self, row: tuple) -> None:CODE
LOWsqlglot/executor/context.py101 def set_index(self, index: int) -> None:CODE
LOWsqlglot/executor/context.py106 def set_range(self, start: int, end: int) -> None:CODE
AI Structural Patterns6 hits · 4 pts
SeverityFileLineSnippetContext
LOWsqlglot/generator.py882CODE
LOWsqlglot/generator.py4725CODE
LOWsqlglot/generator.py5668CODE
LOWsqlglot/lineage.py196CODE
LOWsqlglot/optimizer/qualify.py19CODE
LOWsqlglot/generators/athena.py133CODE