A library to work with SQL syntax trees in F#. Can be used for:
- Analyzing queries
- Finding performance problems
- Checking permissions
- Rewriting queries
- Optimize poorly written queries
- Add/remove conditions to
WHEREclause for security, etc
- Generating scripts from modified SQL syntax trees
It covers 100% of TSQL, because it leverages the existing TransactSql.ScriptDom C# library from Microsoft, and is able to convert losslessly* back and forth between Microsofts C# type hierarchy, and a new set of discriminated unions in F#.
* Stream token positions excluded
Install from nuget:
Gallery WPF App
The main output of this project is a class library, but it also has a windows application with some examples and tools to help use the library (and the C# library from Microsoft).
- Basic usage
- Syntax Builder (similar to Roslyn Quoter
- Table Relationships vizualizer (based on analysing AST of views, procedures, and functions)
- Q: Why generate only discriminated unions (DUs) with many fields, instead of DUs with a single record value?
- A: In this case, it would result it way too many types, which creates a compiler (and tooling) performance problem.