Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Translate from the DML to the BigQuery dialect.
Synopsis
- data Error
- = FromTypeUnsupported (SelectFromG 'BigQuery Expression)
- | NoOrderSpecifiedInOrderBy
- | MalformedAgg
- | FieldTypeUnsupportedForNow (AnnFieldG 'BigQuery Void Expression)
- | AggTypeUnsupportedForNow (TableAggregateFieldG 'BigQuery Void Expression)
- | NodesUnsupportedForNow (TableAggregateFieldG 'BigQuery Void Expression)
- | NoProjectionFields
- | NoAggregatesMustBeABug
- | UnsupportedArraySelect (ArraySelectG 'BigQuery Void Expression)
- | UnsupportedOpExpG (OpExpG 'BigQuery Expression)
- | UnsupportedSQLExp Expression
- | UnsupportedDistinctOn
- | UnexpectedEmptyList
- | InvalidIntegerishSql Expression
- | ConnectionsNotSupported
- | ActionsNotSupported
- | ComputedFieldsBooleanExpressionNotSupported
- | ComputedFieldsOrderByNotSupported
- | ScalarComputedFieldsNotSupported
- | NoParentEntityInternalError
- data FromIr a
- newtype FromIrWriter = FromIrWriter {}
- data FromIrConfig = FromIrConfig {}
- defaultFromIrConfig :: FromIrConfig
- runFromIr :: FromIrConfig -> FromIr a -> Validate (NonEmpty Error) (a, FromIrWriter)
- bigQuerySourceConfigToFromIrConfig :: BigQuerySourceConfig -> FromIrConfig
- mkSQLSelect :: JsonAggSelect -> AnnSelectG 'BigQuery (AnnFieldG 'BigQuery Void) Expression -> FromIr Select
- fromRootField :: QueryDB 'BigQuery Void Expression -> FromIr Select
- fromSelectAggregate :: Maybe (EntityAlias, HashMap ColumnName ColumnName) -> AnnSelectG 'BigQuery (TableAggregateFieldG 'BigQuery Void) Expression -> FromIr Select
Documentation
Most of these errors should be checked for legitimacy.
The base monad used throughout this module for all conversion functions.
It's a Validate, so it'll continue going when it encounters errors to accumulate as many as possible.
It also contains a mapping from entity prefixes to counters. So if my prefix is "table" then there'll be a counter that lets me generate table1, table2, etc. Same for any other prefix needed (e.g. names for joins).
A ReaderT is used around this in most of the module too, for
setting the current entity that a given field name refers to. See
fromColumn
.
Instances
Applicative FromIr Source # | |
Functor FromIr Source # | |
Monad FromIr Source # | |
MonadWriter FromIrWriter FromIr Source # | |
Defined in Hasura.Backends.BigQuery.FromIr writer :: (a, FromIrWriter) -> FromIr a # tell :: FromIrWriter -> FromIr () # listen :: FromIr a -> FromIr (a, FromIrWriter) # pass :: FromIr (a, FromIrWriter -> FromIrWriter) -> FromIr a # | |
MonadValidate (NonEmpty Error) FromIr Source # | |
newtype FromIrWriter Source #
Collected from using a native query in a query. Each entry here because a CTE to be prepended to the query.
Instances
Monoid FromIrWriter Source # | |
Defined in Hasura.Backends.BigQuery.FromIr mempty :: FromIrWriter # mappend :: FromIrWriter -> FromIrWriter -> FromIrWriter # mconcat :: [FromIrWriter] -> FromIrWriter # | |
Semigroup FromIrWriter Source # | |
Defined in Hasura.Backends.BigQuery.FromIr (<>) :: FromIrWriter -> FromIrWriter -> FromIrWriter # sconcat :: NonEmpty FromIrWriter -> FromIrWriter # stimes :: Integral b => b -> FromIrWriter -> FromIrWriter # | |
MonadWriter FromIrWriter FromIr Source # | |
Defined in Hasura.Backends.BigQuery.FromIr writer :: (a, FromIrWriter) -> FromIr a # tell :: FromIrWriter -> FromIr () # listen :: FromIr a -> FromIr (a, FromIrWriter) # pass :: FromIr (a, FromIrWriter -> FromIrWriter) -> FromIr a # |
data FromIrConfig Source #
Config values for the from-IR translator.
FromIrConfig | |
|
defaultFromIrConfig :: FromIrConfig Source #
A default config.
runFromIr :: FromIrConfig -> FromIr a -> Validate (NonEmpty Error) (a, FromIrWriter) Source #
mkSQLSelect :: JsonAggSelect -> AnnSelectG 'BigQuery (AnnFieldG 'BigQuery Void) Expression -> FromIr Select Source #
Here is where we apply a top-level annotation to the select to indicate to the data loader that this select ought to produce a single object or an array.
fromRootField :: QueryDB 'BigQuery Void Expression -> FromIr Select Source #
Convert from the IR database query into a select.