{"id":51037348,"url":"https://github.com/protegrity/sqlglot-net","last_synced_at":"2026-06-22T07:32:14.404Z","repository":{"id":363597479,"uuid":"1264094067","full_name":"protegrity/sqlglot-net","owner":"protegrity","description":"Standalone .NET port of sql-glot-rust, a SQL parser, optimizer, and transpiler library.","archived":false,"fork":false,"pushed_at":"2026-06-09T15:50:19.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-09T16:14:31.937Z","etag":null,"topics":["csharp","dotnet","parser","sql","transpiler"],"latest_commit_sha":null,"homepage":"https://github.com/protegrity/sqlglot-net#readme","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/protegrity.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":"SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-09T14:54:10.000Z","updated_at":"2026-06-09T16:00:13.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/protegrity/sqlglot-net","commit_stats":null,"previous_names":["protegrity/sqlglot-net"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/protegrity/sqlglot-net","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/protegrity%2Fsqlglot-net","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/protegrity%2Fsqlglot-net/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/protegrity%2Fsqlglot-net/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/protegrity%2Fsqlglot-net/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/protegrity","download_url":"https://codeload.github.com/protegrity/sqlglot-net/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/protegrity%2Fsqlglot-net/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34639704,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-22T02:00:06.391Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","dotnet","parser","sql","transpiler"],"created_at":"2026-06-22T07:32:12.590Z","updated_at":"2026-06-22T07:32:14.395Z","avatar_url":"https://github.com/protegrity.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SqlGlot.Net\n\nA standalone .NET port of [sql-glot-rust](https://github.com/protegrity/sql-glot-rust) — a SQL parser,\noptimizer, and transpiler library.\n\nThis project is a pure-managed C# implementation with no native dependencies,\nsuitable for ADO.NET drivers, EF Core providers, AOT-compiled apps, Blazor WebAssembly,\nAzure Functions, and other .NET hosts.\n\n## Status\n\nThis is a **foundational port** that mirrors the Rust crate layout 1:1, so\nfurther porting is mechanical. The initial drop covers the end-to-end happy path:\n\n| Module                     | Rust LOC | .NET status |\n|----------------------------|----------|-------------|\n| `tokens/`                  | ~2,000   | ✅ Lexer ported (literals, operators, identifiers, comments, keywords) |\n| `errors/`                  | ~30      | ✅ Exception hierarchy |\n| `dialects/`                | ~1,000   | ✅ Dialect enum + quoting rules (30 dialects) |\n| `ast/types.rs`             | ~2,300   | ✅ Statement + Expr subset (SELECT path, full operator set) |\n| `parser/sql_parser.rs`     | ~4,000   | ✅ Recursive-descent SELECT/FROM/JOIN/WHERE/GROUP BY/HAVING/ORDER BY/LIMIT |\n| `generator/sql_generator.rs` | ~3,300 | ✅ Visitor-based emitter with dialect quoting |\n| `builder/`                 | ~1,500   | ⏳ Fluent builder API (TODO) |\n| `optimizer/`               | ~3,000   | ⏳ TODO |\n| `executor/`, `planner/`, `schema/`, `diff/` | ~4,000 | ⏳ TODO |\n\n**Roundtrips today:** `SELECT … FROM … [JOIN …] [WHERE …] [GROUP BY …] [HAVING …]\n[ORDER BY …] [LIMIT n [OFFSET n]]` with full expression grammar (arithmetic,\ncomparison, logical, IS NULL, IN, BETWEEN, LIKE, CASE, CAST, function calls,\nparenthesised sub-expressions, qualified columns).\n\n## Layout\n\n```\nsqlglot-net/\n├── SqlGlot.Net.sln\n├── src/\n│   └── SqlGlot.Net/\n│       ├── SqlGlot.Net.csproj\n│       ├── SqlGlot.cs                  # public Parse / Generate / Transpile API\n│       ├── Errors/\n│       │   └── SqlGlotException.cs\n│       ├── Dialects/\n│       │   └── Dialect.cs              # 30-dialect enum + QuoteStyle helpers\n│       ├── Tokens/\n│       │   ├── TokenType.cs\n│       │   ├── Token.cs\n│       │   └── Tokenizer.cs\n│       ├── Ast/\n│       │   ├── Statement.cs            # Statement abstract + sub-records\n│       │   ├── Expr.cs                 # Expr abstract + sub-records\n│       │   └── Common.cs               # QuoteStyle, BinaryOperator, etc.\n│       ├── Parser/\n│       │   └── SqlParser.cs\n│       └── Generator/\n│           └── SqlGenerator.cs\n└── tests/\n    └── SqlGlot.Net.Tests/\n        ├── SqlGlot.Net.Tests.csproj\n        ├── TokenizerTests.cs\n        ├── ParserTests.cs\n        ├── GeneratorTests.cs\n        └── RoundtripTests.cs\n```\n\n## Quick start\n\n```csharp\nusing SqlGlot.Net;\nusing SqlGlot.Net.Dialects;\n\n// Parse\nvar ast = SqlGlot.Parse(\"SELECT a, b FROM t WHERE a \u003e 1\", Dialect.Ansi);\n\n// Generate\nvar sql = SqlGlot.Generate(ast, Dialect.Postgres);\n// =\u003e SELECT a, b FROM t WHERE a \u003e 1\n\n// Transpile in one call\nvar tsql = SqlGlot.Transpile(\n    \"SELECT \\\"id\\\" FROM users\",\n    from: Dialect.Postgres,\n    to: Dialect.Tsql);\n// =\u003e SELECT [id] FROM users\n```\n\n## Build \u0026 test\n\n```bash\ndotnet build\ndotnet test\ndotnet pack src/SqlGlot.Net/SqlGlot.Net.csproj -c Release\n```\n\nTargets `net10.0`. No third-party runtime dependencies.\n\n## Project health\n\n- CI runs on GitHub Actions for every push and pull request.\n- Community support and contribution guidance live in `CONTRIBUTING.md`, `SECURITY.md`, and `SUPPORT.md`.\n- The package metadata is set up for public NuGet publishing.\n\n## Porting strategy\n\nThe Rust source is the source of truth. Each .NET type carries an\n`// Rust: \u003cpath\u003e:\u003csymbol\u003e` comment that points to the originating Rust item so\nsyncing future Rust changes is a line-by-line exercise.\n\nRoadmap order (recommended): expression grammar gaps (window functions, EXTRACT,\nINTERVAL) → INSERT/UPDATE/DELETE/MERGE → CREATE/ALTER/DROP → builder fluent API\n→ optimizer passes → schema \u0026 planner → diff/executor.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprotegrity%2Fsqlglot-net","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprotegrity%2Fsqlglot-net","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprotegrity%2Fsqlglot-net/lists"}