You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
How can I run queryparser not with stack ghci ?
In which way can I run it with cmd ? Receiving query file as input and file name to output ?
How can we make it more generic that it is not using stack ghci.
Can you kindly please provide us some examples ?
Sorry I'm not families with stack or Haskall at all.
I believe if you want to develop queryparser, you will need to use stack. However, if you want to just use queryparser in a Haskell environment, there are packages on Hackage that you can directly import.
If you're looking for a downloadable binary executable, we don't have one published. However, try following along with the readme to get the demo up and running.
Hi, How can I run queryparser not with stack ghci ? In which way can I run it with cmd ? Receiving query file as input and file name to output ? How can we make it more generic that it is not using stack ghci. Can you kindly please provide us some examples ?
Sorry I'm not families with stack or Haskall at all.
This starts up the shell:
stack ghci
This sets the shell prompt right:
:set prompt "sql> "
This is how you can parse a simple statement of PrestoSQL:
sql>Database.Sql.Presto.Parser.parse "SELECT 1;"
Right (PrestoStandardSqlStatement (QueryStmt (QuerySelect (Range {start = Position {positionLine = 1, positionColumn = 0, positionOffset = 0}, end = Position {positionLine = 1, positionColumn = 8, positionOffset = 8}}) (Select {selectInfo = Range {start = Position {positionLine = 1, positionColumn = 0, positionOffset = 0}, end = Position {positionLine = 1, positionColumn = 8, positionOffset = 8}}, selectCols = SelectColumns {selectColumnsInfo = Range {start = Position {positionLine = 1, positionColumn = 7, positionOffset = 7}, end = Position {positionLine = 1, positionColumn = 8, positionOffset = 8}}, selectColumnsList = [SelectExpr (Range {start = Position {positionLine = 1, positionColumn = 7, positionOffset = 7}, end = Position {positionLine = 1, positionColumn = 8, positionOffset = 8}}) [ColumnAlias (Range {start = Position {positionLine = 1, positionColumn = 7, positionOffset = 7}, end = Position {positionLine = 1, positionColumn = 8, positionOffset = 8}}) "_col0" (ColumnAliasId 1)] (ConstantExpr (Range {start = Position {positionLine = 1, positionColumn = 7, positionOffset = 7}, end = Position {positionLine = 1, positionColumn = 8, positionOffset = 8}}) (NumericConstant (Range {start = Position {positionLine = 1, positionColumn = 7, positionOffset = 7}, end = Position {positionLine = 1, positionColumn = 8, positionOffset = 8}}) "1"))]}, selectFrom = Nothing, selectWhere = Nothing, selectTimeseries = Nothing, selectGroup = Nothing, selectHaving = Nothing, selectNamedWindow = Nothing, selectDistinct = Distinct False}))))
This is how you can use the Demo setup:
sql> import Demo
sql> demoAllAnalyses "SELECT * FROM foo"Tables accessed:
public.foo
Columns accessed by clause:
public.foo.a SELECT
public.foo.b SELECT
public.foo.c SELECTJoins:
no joins
Table lineage:
no tables modified
This depends on the content of the demo folder. There is for example a catalog setup that has some tables:
-- and construct a catalog, with tables `foo` (columns a, b, and c) and `bar` (columns x, y, and z)catalog::Catalog
catalog = makeDefaultingCatalog catalogMap [defaultSchema] defaultDatabase
wheredefaultDatabase::DatabaseName()
defaultDatabase =DatabaseName()"defaultDatabase"defaultSchema::UQSchemaName()
defaultSchema = mkNormalSchema "public"()foo:: (UQTableName(), SchemaMember)
foo = ( QTableName()None"foo", persistentTable [ QColumnName()None"a"
, QColumnName()None"b"
, QColumnName()None"c"
] )
bar:: (UQTableName(), SchemaMember)
bar = ( QTableName()None"bar", persistentTable [ QColumnName()None"x"
, QColumnName()None"y"
, QColumnName()None"z"
] )
catalogMap::CatalogMap
catalogMap =HMS.singleton defaultDatabase $HMS.fromList [ ( defaultSchema, HMS.fromList [ foo , bar ] ) ]
Activity
h4v0kh3l1 commentedon Aug 24, 2021
I believe if you want to develop queryparser, you will need to use stack. However, if you want to just use queryparser in a Haskell environment, there are packages on Hackage that you can directly import.
If you're looking for a downloadable binary executable, we don't have one published. However, try following along with the readme to get the demo up and running.
l1x commentedon Dec 25, 2021
This starts up the shell:
This sets the shell prompt right:
This is how you can parse a simple statement of PrestoSQL:
This is how you can use the Demo setup:
This depends on the content of the demo folder. There is for example a catalog setup that has some tables: