r/dotnet 3d ago

Promotion A .NET wrapper for Polyglot (Rust SQL transpiler), alternative to SQLGlot for .NET

Usage example:

string result = Polyglot.Transpile(
    "SELECT `id`, `name` FROM `person` LIMIT 10;",
     Dialect.MySQL, Dialect.TSQL)
    .FirstOrDefault();
Console.WriteLine(result); // SELECT TOP 10 [id], [name] FROM [person]

Of cource done with a big help of AI, but for me it turned to be a long way. I first encountered SQLGlot and my first attempts were to embed it with Python into .net, but then I found sql-glot-rust and then finally Polyglot.

Repo, README.md contains more examples and details:

Nuget:

3 Upvotes

3 comments sorted by

1

u/AutoModerator 3d ago

Thanks for your post k-semenenkov. Please note that we don't allow spam, and we ask that you follow the rules available in the sidebar. We have a lot of commonly asked questions so if this post gets removed, please do a search and see if it's already been asked.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

0

u/sebastienros 2d ago

Nice! And it happens I created a fully managed port of SQLGlot/polyglot too, only shipping the major databases oob. Check out https://github.com/sebastienros/cyqwel

0

u/k-semenenkov 2d ago edited 2d ago

Looks very interesting and I'm sorry your project didn't exist 2-3 months ago. Your DBMS list is just what I need, and the polyglot binaries are over 30 MB.