Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resolve conflict between table_id and column_id parsers #73

Merged
merged 1 commit into from
Mar 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions picard/picard.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -119,17 +119,25 @@ test-suite spec
Language.SQL.SpiderSQL.Car1
Language.SQL.SpiderSQL.Chinook1
Language.SQL.SpiderSQL.ConcertSinger
Language.SQL.SpiderSQL.CreDocTemplateMgt
Language.SQL.SpiderSQL.DepartmentManagement
Language.SQL.SpiderSQL.DogKennels
Language.SQL.SpiderSQL.Flight1
Language.SQL.SpiderSQL.Geo
Language.SQL.SpiderSQL.Inn1
Language.SQL.SpiderSQL.MatchSeason
Language.SQL.SpiderSQL.MuseumVisit
Language.SQL.SpiderSQL.Orchestra
Language.SQL.SpiderSQL.Pets1
Language.SQL.SpiderSQL.PhoneMarket
Language.SQL.SpiderSQL.PokerPlayer
Language.SQL.SpiderSQL.ProductCatalog
Language.SQL.SpiderSQL.Scholar
Language.SQL.SpiderSQL.Singer
Language.SQL.SpiderSQL.StormRecord
Language.SQL.SpiderSQL.StudentTranscriptsTracking
Language.SQL.SpiderSQL.TestItem
Language.SQL.SpiderSQL.Wta1
hs-source-dirs:
tests
default-extensions: DeriveDataTypeable ExistentialQuantification FlexibleInstances KindSignatures LambdaCase MagicHash RankNTypes RecordWildCards ScopedTypeVariables TypeSynonymInstances DataKinds DeriveGeneric DerivingStrategies DeriveAnyClass DerivingVia GeneralizedNewtypeDeriving FlexibleContexts TypeApplications ConstraintKinds MultiParamTypeClasses TupleSections
Expand Down
2 changes: 1 addition & 1 deletion picard/src/Language/SQL/SpiderSQL/Parse.hs
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ colUnit sx = flip (<?>) "colUnit" $ do
let p = do
distinct <- optional (try $ isDistinct <* someSpace)
(tabAli, col) <-
try ((Nothing,) <$> columnId sx)
try ((Nothing,) <$> columnId sx <* notFollowedBy isDot)
<|> try
( (,)
<$> (Just <$> (eitherP tableId alias' <* isDot))
Expand Down
40 changes: 40 additions & 0 deletions picard/tests/Language/SQL/SpiderSQL/CreDocTemplateMgt.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{-# LANGUAGE OverloadedStrings #-}

module Language.SQL.SpiderSQL.CreDocTemplateMgt where

import qualified Data.HashMap.Strict as HashMap
import qualified Data.Text as Text (Text)
import Language.SQL.SpiderSQL.TestItem (TestItem (..))
import Picard.Types (ColumnType (..), SQLSchema (..))

creDocTemplateMgtSchema :: SQLSchema
creDocTemplateMgtSchema =
let columnNames = HashMap.fromList [("1", "Template_Type_Code"), ("10", "Template_ID"), ("11", "Document_Name"), ("12", "Document_Description"), ("13", "Other_Details"), ("14", "Paragraph_ID"), ("15", "Document_ID"), ("16", "Paragraph_Text"), ("17", "Other_Details"), ("2", "Template_Type_Description"), ("3", "Template_ID"), ("4", "Version_Number"), ("5", "Template_Type_Code"), ("6", "Date_Effective_From"), ("7", "Date_Effective_To"), ("8", "Template_Details"), ("9", "Document_ID")]
columnTypes = HashMap.fromList [("1", ColumnType_TEXT), ("10", ColumnType_NUMBER), ("11", ColumnType_TEXT), ("12", ColumnType_TEXT), ("13", ColumnType_TEXT), ("14", ColumnType_NUMBER), ("15", ColumnType_NUMBER), ("16", ColumnType_TEXT), ("17", ColumnType_TEXT), ("2", ColumnType_TEXT), ("3", ColumnType_NUMBER), ("4", ColumnType_NUMBER), ("5", ColumnType_TEXT), ("6", ColumnType_TIME), ("7", ColumnType_TIME), ("8", ColumnType_TEXT), ("9", ColumnType_NUMBER)]
tableNames = HashMap.fromList [("0", "Ref_Template_Types"), ("1", "Templates"), ("2", "Documents"), ("3", "Paragraphs")]
columnToTable = HashMap.fromList [("1", "0"), ("10", "2"), ("11", "2"), ("12", "2"), ("13", "2"), ("14", "3"), ("15", "3"), ("16", "3"), ("17", "3"), ("2", "0"), ("3", "1"), ("4", "1"), ("5", "1"), ("6", "1"), ("7", "1"), ("8", "1"), ("9", "2")]
tableToColumns = HashMap.fromList [("0", ["1", "2"]), ("1", ["3", "4", "5", "6", "7", "8"]), ("2", ["9", "10", "11", "12", "13"]), ("3", ["14", "15", "16", "17"])]
foreignKeys = HashMap.fromList [("10", "3"), ("15", "9"), ("5", "1")]
primaryKeys = ["1", "3", "9", "14"]
in SQLSchema {sQLSchema_columnNames = columnNames, sQLSchema_columnTypes = columnTypes, sQLSchema_tableNames = tableNames, sQLSchema_columnToTable = columnToTable, sQLSchema_tableToColumns = tableToColumns, sQLSchema_foreignKeys = foreignKeys, sQLSchema_primaryKeys = primaryKeys}

creDocTemplateMgtQueries :: [Text.Text]
creDocTemplateMgtQueries =
[ "select template_type_code from templates group by template_type_code having count(*) < 3"
]

creDocTemplateMgtQueriesFails :: [Text.Text]
creDocTemplateMgtQueriesFails = []

creDocTemplateMgtParserTests :: TestItem
creDocTemplateMgtParserTests =
Group "creDocTemplateMgt" $
(ParseQueryExprWithGuardsAndTypeChecking creDocTemplateMgtSchema <$> creDocTemplateMgtQueries)
<> (ParseQueryExprWithGuards creDocTemplateMgtSchema <$> creDocTemplateMgtQueries)
<> (ParseQueryExprWithoutGuards creDocTemplateMgtSchema <$> creDocTemplateMgtQueries)
<> (ParseQueryExprFails creDocTemplateMgtSchema <$> creDocTemplateMgtQueriesFails)

creDocTemplateMgtLexerTests :: TestItem
creDocTemplateMgtLexerTests =
Group "creDocTemplateMgt" $
LexQueryExpr creDocTemplateMgtSchema <$> creDocTemplateMgtQueries
41 changes: 41 additions & 0 deletions picard/tests/Language/SQL/SpiderSQL/DogKennels.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{-# LANGUAGE OverloadedStrings #-}

module Language.SQL.SpiderSQL.DogKennels where

import qualified Data.HashMap.Strict as HashMap
import qualified Data.Text as Text (Text)
import Language.SQL.SpiderSQL.TestItem (TestItem (..))
import Picard.Types (ColumnType (..), SQLSchema (..))

dogKennelsSchema :: SQLSchema
dogKennelsSchema =
let columnNames = HashMap.fromList [("1", "breed_code"), ("10", "owner_id"), ("11", "first_name"), ("12", "last_name"), ("13", "street"), ("14", "city"), ("15", "state"), ("16", "zip_code"), ("17", "email_address"), ("18", "home_phone"), ("19", "cell_number"), ("2", "breed_name"), ("20", "dog_id"), ("21", "owner_id"), ("22", "abandoned_yn"), ("23", "breed_code"), ("24", "size_code"), ("25", "name"), ("26", "age"), ("27", "date_of_birth"), ("28", "gender"), ("29", "weight"), ("3", "charge_id"), ("30", "date_arrived"), ("31", "date_adopted"), ("32", "date_departed"), ("33", "professional_id"), ("34", "role_code"), ("35", "first_name"), ("36", "street"), ("37", "city"), ("38", "state"), ("39", "zip_code"), ("4", "charge_type"), ("40", "last_name"), ("41", "email_address"), ("42", "home_phone"), ("43", "cell_number"), ("44", "treatment_id"), ("45", "dog_id"), ("46", "professional_id"), ("47", "treatment_type_code"), ("48", "date_of_treatment"), ("49", "cost_of_treatment"), ("5", "charge_amount"), ("6", "size_code"), ("7", "size_description"), ("8", "treatment_type_code"), ("9", "treatment_type_description")]
columnTypes = HashMap.fromList [("1", ColumnType_TEXT), ("10", ColumnType_NUMBER), ("11", ColumnType_TEXT), ("12", ColumnType_TEXT), ("13", ColumnType_TEXT), ("14", ColumnType_TEXT), ("15", ColumnType_TEXT), ("16", ColumnType_TEXT), ("17", ColumnType_TEXT), ("18", ColumnType_TEXT), ("19", ColumnType_TEXT), ("2", ColumnType_TEXT), ("20", ColumnType_NUMBER), ("21", ColumnType_NUMBER), ("22", ColumnType_TEXT), ("23", ColumnType_TEXT), ("24", ColumnType_TEXT), ("25", ColumnType_TEXT), ("26", ColumnType_TEXT), ("27", ColumnType_TIME), ("28", ColumnType_TEXT), ("29", ColumnType_TEXT), ("3", ColumnType_NUMBER), ("30", ColumnType_TIME), ("31", ColumnType_TIME), ("32", ColumnType_TIME), ("33", ColumnType_NUMBER), ("34", ColumnType_TEXT), ("35", ColumnType_TEXT), ("36", ColumnType_TEXT), ("37", ColumnType_TEXT), ("38", ColumnType_TEXT), ("39", ColumnType_TEXT), ("4", ColumnType_TEXT), ("40", ColumnType_TEXT), ("41", ColumnType_TEXT), ("42", ColumnType_TEXT), ("43", ColumnType_TEXT), ("44", ColumnType_NUMBER), ("45", ColumnType_NUMBER), ("46", ColumnType_NUMBER), ("47", ColumnType_TEXT), ("48", ColumnType_TIME), ("49", ColumnType_NUMBER), ("5", ColumnType_NUMBER), ("6", ColumnType_TEXT), ("7", ColumnType_TEXT), ("8", ColumnType_TEXT), ("9", ColumnType_TEXT)]
tableNames = HashMap.fromList [("0", "Breeds"), ("1", "Charges"), ("2", "Sizes"), ("3", "Treatment_Types"), ("4", "Owners"), ("5", "Dogs"), ("6", "Professionals"), ("7", "Treatments")]
columnToTable = HashMap.fromList [("1", "0"), ("10", "4"), ("11", "4"), ("12", "4"), ("13", "4"), ("14", "4"), ("15", "4"), ("16", "4"), ("17", "4"), ("18", "4"), ("19", "4"), ("2", "0"), ("20", "5"), ("21", "5"), ("22", "5"), ("23", "5"), ("24", "5"), ("25", "5"), ("26", "5"), ("27", "5"), ("28", "5"), ("29", "5"), ("3", "1"), ("30", "5"), ("31", "5"), ("32", "5"), ("33", "6"), ("34", "6"), ("35", "6"), ("36", "6"), ("37", "6"), ("38", "6"), ("39", "6"), ("4", "1"), ("40", "6"), ("41", "6"), ("42", "6"), ("43", "6"), ("44", "7"), ("45", "7"), ("46", "7"), ("47", "7"), ("48", "7"), ("49", "7"), ("5", "1"), ("6", "2"), ("7", "2"), ("8", "3"), ("9", "3")]
tableToColumns = HashMap.fromList [("0", ["1", "2"]), ("1", ["3", "4", "5"]), ("2", ["6", "7"]), ("3", ["8", "9"]), ("4", ["10", "11", "12", "13", "14", "15", "16", "17", "18", "19"]), ("5", ["20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32"]), ("6", ["33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43"]), ("7", ["44", "45", "46", "47", "48", "49"])]
foreignKeys = HashMap.fromList [("21", "10"), ("23", "1"), ("24", "6"), ("45", "20"), ("46", "33"), ("47", "8")]
primaryKeys = ["1", "3", "6", "8", "10", "20", "33", "44"]
in SQLSchema {sQLSchema_columnNames = columnNames, sQLSchema_columnTypes = columnTypes, sQLSchema_tableNames = tableNames, sQLSchema_columnToTable = columnToTable, sQLSchema_tableToColumns = tableToColumns, sQLSchema_foreignKeys = foreignKeys, sQLSchema_primaryKeys = primaryKeys}

dogKennelsQueries :: [Text.Text]
dogKennelsQueries =
[ "select first_name from professionals union select first_name from owners except select name from dogs",
"select t1.owner_id, t1.zip_code from owners as t1 join dogs as t2 on t1.owner_id = t2.owner_id join treatments as t3 on t2.dog_id = t3.dog_id group by t1.owner_id order by sum(t3.cost_of_treatment) desc limit 1"
]

dogKennelsQueriesFails :: [Text.Text]
dogKennelsQueriesFails = []

dogKennelsParserTests :: TestItem
dogKennelsParserTests =
Group "dogKennels" $
(ParseQueryExprWithGuardsAndTypeChecking dogKennelsSchema <$> dogKennelsQueries)
<> (ParseQueryExprWithGuards dogKennelsSchema <$> dogKennelsQueries)
<> (ParseQueryExprWithoutGuards dogKennelsSchema <$> dogKennelsQueries)
<> (ParseQueryExprFails dogKennelsSchema <$> dogKennelsQueriesFails)

dogKennelsLexerTests :: TestItem
dogKennelsLexerTests =
Group "dogKennels" $
LexQueryExpr dogKennelsSchema <$> dogKennelsQueries
41 changes: 41 additions & 0 deletions picard/tests/Language/SQL/SpiderSQL/MuseumVisit.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{-# LANGUAGE OverloadedStrings #-}

module Language.SQL.SpiderSQL.MuseumVisit where

import qualified Data.HashMap.Strict as HashMap
import qualified Data.Text as Text (Text)
import Language.SQL.SpiderSQL.TestItem (TestItem (..))
import Picard.Types (ColumnType (..), SQLSchema (..))

museumVisitSchema :: SQLSchema
museumVisitSchema =
let columnNames = HashMap.fromList [("1", "Museum_ID"), ("10", "visitor_ID"), ("11", "Num_of_Ticket"), ("12", "Total_spent"), ("2", "Name"), ("3", "Num_of_Staff"), ("4", "Open_Year"), ("5", "ID"), ("6", "Name"), ("7", "Level_of_membership"), ("8", "Age"), ("9", "Museum_ID")]
columnTypes = HashMap.fromList [("1", ColumnType_NUMBER), ("10", ColumnType_NUMBER), ("11", ColumnType_NUMBER), ("12", ColumnType_NUMBER), ("2", ColumnType_TEXT), ("3", ColumnType_NUMBER), ("4", ColumnType_NUMBER), ("5", ColumnType_NUMBER), ("6", ColumnType_TEXT), ("7", ColumnType_NUMBER), ("8", ColumnType_NUMBER), ("9", ColumnType_NUMBER)]
tableNames = HashMap.fromList [("0", "museum"), ("1", "visitor"), ("2", "visit")]
columnToTable = HashMap.fromList [("1", "0"), ("10", "2"), ("11", "2"), ("12", "2"), ("2", "0"), ("3", "0"), ("4", "0"), ("5", "1"), ("6", "1"), ("7", "1"), ("8", "1"), ("9", "2")]
tableToColumns = HashMap.fromList [("0", ["1", "2", "3", "4"]), ("1", ["5", "6", "7", "8"]), ("2", ["9", "10", "11", "12"])]
foreignKeys = HashMap.fromList [("10", "5"), ("9", "1")]
primaryKeys = ["1", "5", "9"]
in SQLSchema {sQLSchema_columnNames = columnNames, sQLSchema_columnTypes = columnTypes, sQLSchema_tableNames = tableNames, sQLSchema_columnToTable = columnToTable, sQLSchema_tableToColumns = tableToColumns, sQLSchema_foreignKeys = foreignKeys, sQLSchema_primaryKeys = primaryKeys}

museumVisitQueries :: [Text.Text]
museumVisitQueries =
[ "select t1.name from visitor as t1 join visit as t2 on t1.id = t2.visitor_id join museum as t3 on t3.museum_id = t2.museum_id where t3.open_year < 2009 intersect select t1.name from visitor as t1 join visit as t2 on t1.id = t2.visitor_id join museum as t3 on t3.museum_id = t2.museum_id where t3.open_year > 2011",
"select count(*) from museum where open_year > 2013 or open_year < 2008"
]

museumVisitQueriesFails :: [Text.Text]
museumVisitQueriesFails = []

museumVisitParserTests :: TestItem
museumVisitParserTests =
Group "museumVisit" $
(ParseQueryExprWithGuardsAndTypeChecking museumVisitSchema <$> museumVisitQueries)
<> (ParseQueryExprWithGuards museumVisitSchema <$> museumVisitQueries)
<> (ParseQueryExprWithoutGuards museumVisitSchema <$> museumVisitQueries)
<> (ParseQueryExprFails museumVisitSchema <$> museumVisitQueriesFails)

museumVisitLexerTests :: TestItem
museumVisitLexerTests =
Group "museumVisit" $
LexQueryExpr museumVisitSchema <$> museumVisitQueries
40 changes: 40 additions & 0 deletions picard/tests/Language/SQL/SpiderSQL/Orchestra.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{-# LANGUAGE OverloadedStrings #-}

module Language.SQL.SpiderSQL.Orchestra where

import qualified Data.HashMap.Strict as HashMap
import qualified Data.Text as Text (Text)
import Language.SQL.SpiderSQL.TestItem (TestItem (..))
import Picard.Types (ColumnType (..), SQLSchema (..))

orchestraSchema :: SQLSchema
orchestraSchema =
let columnNames = HashMap.fromList [("1", "Conductor_ID"), ("10", "Year_of_Founded"), ("11", "Major_Record_Format"), ("12", "Performance_ID"), ("13", "Orchestra_ID"), ("14", "Type"), ("15", "Date"), ("16", "Official_ratings_(millions)"), ("17", "Weekly_rank"), ("18", "Share"), ("19", "Show_ID"), ("2", "Name"), ("20", "Performance_ID"), ("21", "If_first_show"), ("22", "Result"), ("23", "Attendance"), ("3", "Age"), ("4", "Nationality"), ("5", "Year_of_Work"), ("6", "Orchestra_ID"), ("7", "Orchestra"), ("8", "Conductor_ID"), ("9", "Record_Company")]
columnTypes = HashMap.fromList [("1", ColumnType_NUMBER), ("10", ColumnType_NUMBER), ("11", ColumnType_TEXT), ("12", ColumnType_NUMBER), ("13", ColumnType_NUMBER), ("14", ColumnType_TEXT), ("15", ColumnType_TEXT), ("16", ColumnType_NUMBER), ("17", ColumnType_TEXT), ("18", ColumnType_TEXT), ("19", ColumnType_NUMBER), ("2", ColumnType_TEXT), ("20", ColumnType_NUMBER), ("21", ColumnType_OTHERS), ("22", ColumnType_TEXT), ("23", ColumnType_NUMBER), ("3", ColumnType_NUMBER), ("4", ColumnType_TEXT), ("5", ColumnType_NUMBER), ("6", ColumnType_NUMBER), ("7", ColumnType_TEXT), ("8", ColumnType_NUMBER), ("9", ColumnType_TEXT)]
tableNames = HashMap.fromList [("0", "conductor"), ("1", "orchestra"), ("2", "performance"), ("3", "show")]
columnToTable = HashMap.fromList [("1", "0"), ("10", "1"), ("11", "1"), ("12", "2"), ("13", "2"), ("14", "2"), ("15", "2"), ("16", "2"), ("17", "2"), ("18", "2"), ("19", "3"), ("2", "0"), ("20", "3"), ("21", "3"), ("22", "3"), ("23", "3"), ("3", "0"), ("4", "0"), ("5", "0"), ("6", "1"), ("7", "1"), ("8", "1"), ("9", "1")]
tableToColumns = HashMap.fromList [("0", ["1", "2", "3", "4", "5"]), ("1", ["6", "7", "8", "9", "10", "11"]), ("2", ["12", "13", "14", "15", "16", "17", "18"]), ("3", ["19", "20", "21", "22", "23"])]
foreignKeys = HashMap.fromList [("13", "6"), ("20", "12"), ("8", "1")]
primaryKeys = ["1", "6", "12"]
in SQLSchema {sQLSchema_columnNames = columnNames, sQLSchema_columnTypes = columnTypes, sQLSchema_tableNames = tableNames, sQLSchema_columnToTable = columnToTable, sQLSchema_tableToColumns = tableToColumns, sQLSchema_foreignKeys = foreignKeys, sQLSchema_primaryKeys = primaryKeys}

orchestraQueries :: [Text.Text]
orchestraQueries =
[ "select orchestra.record_company from orchestra order by orchestra.year_of_founded desc"
]

orchestraQueriesFails :: [Text.Text]
orchestraQueriesFails = []

orchestraParserTests :: TestItem
orchestraParserTests =
Group "orchestra" $
(ParseQueryExprWithGuardsAndTypeChecking orchestraSchema <$> orchestraQueries)
<> (ParseQueryExprWithGuards orchestraSchema <$> orchestraQueries)
<> (ParseQueryExprWithoutGuards orchestraSchema <$> orchestraQueries)
<> (ParseQueryExprFails orchestraSchema <$> orchestraQueriesFails)

orchestraLexerTests :: TestItem
orchestraLexerTests =
Group "orchestra" $
LexQueryExpr orchestraSchema <$> orchestraQueries
40 changes: 40 additions & 0 deletions picard/tests/Language/SQL/SpiderSQL/PokerPlayer.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{-# LANGUAGE OverloadedStrings #-}

module Language.SQL.SpiderSQL.PokerPlayer where

import qualified Data.HashMap.Strict as HashMap
import qualified Data.Text as Text (Text)
import Language.SQL.SpiderSQL.TestItem (TestItem (..))
import Picard.Types (ColumnType (..), SQLSchema (..))

pokerPlayerSchema :: SQLSchema
pokerPlayerSchema =
let columnNames = HashMap.fromList [("1", "Poker_Player_ID"), ("10", "Birth_Date"), ("11", "Height"), ("2", "People_ID"), ("3", "Final_Table_Made"), ("4", "Best_Finish"), ("5", "Money_Rank"), ("6", "Earnings"), ("7", "People_ID"), ("8", "Nationality"), ("9", "Name")]
columnTypes = HashMap.fromList [("1", ColumnType_NUMBER), ("10", ColumnType_TEXT), ("11", ColumnType_NUMBER), ("2", ColumnType_NUMBER), ("3", ColumnType_NUMBER), ("4", ColumnType_NUMBER), ("5", ColumnType_NUMBER), ("6", ColumnType_NUMBER), ("7", ColumnType_NUMBER), ("8", ColumnType_TEXT), ("9", ColumnType_TEXT)]
tableNames = HashMap.fromList [("0", "poker_player"), ("1", "people")]
columnToTable = HashMap.fromList [("1", "0"), ("10", "1"), ("11", "1"), ("2", "0"), ("3", "0"), ("4", "0"), ("5", "0"), ("6", "0"), ("7", "1"), ("8", "1"), ("9", "1")]
tableToColumns = HashMap.fromList [("0", ["1", "2", "3", "4", "5", "6"]), ("1", ["7", "8", "9", "10", "11"])]
foreignKeys = HashMap.fromList [("2", "7")]
primaryKeys = ["1", "7"]
in SQLSchema {sQLSchema_columnNames = columnNames, sQLSchema_columnTypes = columnTypes, sQLSchema_tableNames = tableNames, sQLSchema_columnToTable = columnToTable, sQLSchema_tableToColumns = tableToColumns, sQLSchema_foreignKeys = foreignKeys, sQLSchema_primaryKeys = primaryKeys}

pokerPlayerQueries :: [Text.Text]
pokerPlayerQueries =
[ "select max(final_table_made) from poker_player where earnings < 200000"
]

pokerPlayerQueriesFails :: [Text.Text]
pokerPlayerQueriesFails = []

pokerPlayerParserTests :: TestItem
pokerPlayerParserTests =
Group "pokerPlayer" $
(ParseQueryExprWithGuardsAndTypeChecking pokerPlayerSchema <$> pokerPlayerQueries)
<> (ParseQueryExprWithGuards pokerPlayerSchema <$> pokerPlayerQueries)
<> (ParseQueryExprWithoutGuards pokerPlayerSchema <$> pokerPlayerQueries)
<> (ParseQueryExprFails pokerPlayerSchema <$> pokerPlayerQueriesFails)

pokerPlayerLexerTests :: TestItem
pokerPlayerLexerTests =
Group "pokerPlayer" $
LexQueryExpr pokerPlayerSchema <$> pokerPlayerQueries
Loading