SqlExp and SqlQuery
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 25/100
Rechercherichtung
Beginne damit, die Definitionen von SqlExp und SqlQuery im Issue sowie die bisherigen Ansätze zu überprüfen, SQL-Abfragen in F#-Datenstrukturen zu parsen. Ermittle, ob eines dieser Modelle die Beispiele für die Sortierung darstellen und weiterhin SQL erzeugen kann; als erledigt gilt die Aufgabe, wenn das ausgewählte Modell diese komplexen Abfrageformen ohne die dokumentierte Laufzeitabweichung verarbeitet.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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?
- Vorherrschende Sprache
- F#
- Sterne
- 627
- Forks
- 148
- Ø Merge
- 2 Std. 2 Min.
- Gemergte PRs (30 T.)
- 1
Entwicklungsumgebung
Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Kein Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus fsprojects/SQLProvider
-
enhancement
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 55/100
fsprojects/SQLProvider#872 · 2 Kommentare ·
-
Repo Assist?Offenenhancement
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 10/100
fsprojects/SQLProvider#870 · 1 Kommentar ·
-
postgresql
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 58/100
fsprojects/SQLProvider#869 · 2 Kommentare ·
-
documentation
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 42/100
fsprojects/SQLProvider#868 · 2 Kommentare ·
-
sql server
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 45/100
fsprojects/SQLProvider#851 · 1 Kommentar ·
Alle Issues in fsprojects/SQLProvider
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
mknw/hames-playground#509 ·
Maintainer antworten meist innerhalb von 1 Tag
-
performance v/6
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
WITCodingClub/calendar-backend#689 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
mysql/mysql-operator#60 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
Maintainer antworten meist innerhalb von 2 Tagen
-
bug state-income-tax states/vt
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
PolicyEngine/policyengine-us#9996 ·
Maintainer antworten meist innerhalb von 2 Tagen