SqlExp and SqlQuery
还没有人认领这个 Issue。
评估
调研方向
首先查看 issue 中的 SqlExp 和 SqlQuery 定义,以及将 SQL 查询解析为 F# 数据结构的现有工作。确定其中一个模型是否能够表示排序示例并继续生成 SQL;当选定的模型能够处理这些复杂的查询形态,且不会出现已记录的运行时不匹配时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
We are currently modelling our SQL-expressions with quite simple context:
SqlExp =
| BaseTable of alias * Table // name of the initiating IQueryable table - this isn't always the ultimate table that is selected
| SelectMany of alias * alias * SelectData * SqlExp // from alias, to alias and join data including to and from table names. Note both the select many and join syntax end up here
| FilterClause of Condition * SqlExp // filters from the where clause(es)
| HavingClause of Condition * SqlExp // filters from the where clause(es)
| Projection of Expression * SqlExp // entire LINQ projection expression tree
| Distinct of SqlExp // distinct indicator
| OrderBy of alias * string * bool * SqlExp // alias and column name, bool indicates ascending sort
| Union of bool * string * SqlExp // true = "union all", false = "union", and subquery
| Skip of int * SqlExp
| Take of int * SqlExp
| Count of SqlExp
| AggregateOp of AggregateOperation * alias * string * SqlExp
and SqlQuery =
{ Filters : Condition list
HavingFilters : Condition list
Links : (alias * LinkData * alias) list
Aliases : Map<string, Table>
Ordering : (alias * string * bool) list
Projection : Expression list
Grouping : (list<alias * string> * list<AggregateOperation * alias * string>) list //key columns, aggregate columns
Distinct : bool
UltimateChild : (string * Table) option
Skip : int option
Take : int option
Union : (bool*string) option
Count : bool
AggregateOp : (AggregateOperation * alias * string) list }
The problem is that we will fail more complex SQL:s, e.g. if you have multiple items like Skips:
select x from xs
skip 1
skip 1
take 1
That code should take 3 from [1;2;3;4] but actually would take 2, but we know this and fail runtime. But then again, the SQL can be more weird, where we can't fail but we expect the typical execution order while the real results should be something else:
select x from xs
take 5
where x > 3
join y in ys
We use our model to generate model -> SQL. There are multiple efforts to do the other way, parse SQL-queries to F# data structures SQL -> model.
Could we, instead of having our own model, steal some model from those efforts, and reverse the functionality to generate SQL?
- 主要语言
- F#
- 星标
- 627
- 派生
- 147
- 平均合并
- 2 小时 2 分钟
- 30 天内合并 PR
- 1
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
fsprojects/SQLProvider 的其他 Issue
-
enhancement
难度 3/5 1-2 天 新手友好度 55/100
fsprojects/SQLProvider#872 · 2 条评论 ·
-
Repo Assist? 未关闭enhancement
难度 5/5 一周以上 新手友好度 10/100
fsprojects/SQLProvider#870 · 1 条评论 ·
-
postgresql
难度 4/5 3-5 天 新手友好度 58/100
fsprojects/SQLProvider#869 · 2 条评论 ·
-
documentation
难度 2/5 1-3 小时 新手友好度 42/100
fsprojects/SQLProvider#868 · 2 条评论 ·
-
sql server
难度 4/5 3-5 天 新手友好度 45/100
fsprojects/SQLProvider#851 · 1 条评论 ·
查看 fsprojects/SQLProvider 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 90/100
-
难度 2/5 1-3 小时 新手友好度 68/100
community-scripts/ProxmoxVE#17396 · 1 条评论 ·
-
bug possible-duplicate
难度 2/5 1-3 小时 新手友好度 88/100
AOSSIE-Org/PictoPy#1553 · 4 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
BasedHardware/omi#15274 · 3 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 88/100