SqlExp and SqlQuery
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
Direzione di ricerca
Inizia esaminando le definizioni di SqlExp e SqlQuery nell’issue e i lavori esistenti per analizzare le query SQL in strutture dati F#. Determina se uno di questi modelli può rappresentare gli esempi di ordinamento e continuare a generare SQL; il lavoro è completato quando il modello scelto gestisce queste forme complesse di query senza la discrepanza a runtime documentata.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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?
- Lingua principale
- F#
- Stelle
- 627
- Fork
- 147
- Merge medio
- 2h 2m
- PR unite (30g)
- 1
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di fsprojects/SQLProvider
-
enhancement
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
fsprojects/SQLProvider#872 · 2 commenti ·
-
Repo Assist? Apertaenhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 10/100
fsprojects/SQLProvider#870 · 1 commento ·
-
postgresql
Difficoltà 4/5 3-5 giorni Idoneità per principianti 58/100
fsprojects/SQLProvider#869 · 2 commenti ·
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 42/100
fsprojects/SQLProvider#868 · 2 commenti ·
-
sql server
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
fsprojects/SQLProvider#851 · 1 commento ·
Tutte le issue di fsprojects/SQLProvider
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
AstrBotDevs/AstrBot#10205 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
OHDSI/Data2Evidence#3394 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100