graphql-engine/server/src-lib/Hasura/Backends/MSSQL/Instances/Metadata.hs
Lyndon Maydwell 41054de113 Data Connectors Native Queries Support
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9499
Co-authored-by: gneeri <10553562+gneeri@users.noreply.github.com>
GitOrigin-RevId: 1e351556c43e643aa973f87adc0306f076cd227e
2023-08-17 02:05:14 +00:00

45 lines
2.2 KiB
Haskell

{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
-- | MSSQL Instances Metadata
--
-- Defines a 'Hasura.RQL.Types.Metadata.Backend.BackendMetadata' type class instance for MSSQL.
module Hasura.Backends.MSSQL.Instances.Metadata () where
import Hasura.Backends.MSSQL.DDL qualified as MSSQL
import Hasura.Backends.MSSQL.Schema.Introspection qualified as MSSQL (listAllTables)
import Hasura.Base.Error (Code (UnexpectedPayload), throw400, throw500)
import Hasura.NativeQuery.InterpolatedQuery (trimQueryEnd)
import Hasura.NativeQuery.Metadata (NativeQueryMetadata (..))
import Hasura.NativeQuery.Validation (validateArgumentDeclaration)
import Hasura.Prelude
import Hasura.RQL.DDL.Relationship (defaultBuildArrayRelationshipInfo, defaultBuildObjectRelationshipInfo)
import Hasura.RQL.Types.BackendType
import Hasura.RQL.Types.Metadata.Backend
instance BackendMetadata 'MSSQL where
prepareCatalog = MSSQL.prepareCatalog
buildComputedFieldInfo = MSSQL.buildComputedFieldInfo
fetchAndValidateEnumValues = MSSQL.fetchAndValidateEnumValues
resolveSourceConfig = MSSQL.resolveSourceConfig
resolveDatabaseMetadata _ _ = MSSQL.resolveDatabaseMetadata
parseBoolExpOperations = MSSQL.parseBoolExpOperations
buildArrayRelationshipInfo _ = defaultBuildArrayRelationshipInfo
buildObjectRelationshipInfo _ = defaultBuildObjectRelationshipInfo
buildFunctionInfo = MSSQL.buildFunctionInfo
updateColumnInEventTrigger = MSSQL.updateColumnInEventTrigger
parseCollectableType = MSSQL.parseCollectableType
postDropSourceHook = MSSQL.postDropSourceHook
buildComputedFieldBooleanExp _ _ _ _ _ _ =
throw500 "Computed fields are not yet defined for MSSQL backends"
supportsBeingRemoteRelationshipTarget _ = True
listAllTables = MSSQL.listAllTables
listAllTrackables _ =
throw500 "Computed fields are not yet defined for MSSQL backends"
getTableInfo _ _ = throw400 UnexpectedPayload "get_table_info not yet supported in MSSQL!"
validateNativeQuery _ _ _ _ _ nq = do
validateArgumentDeclaration nq
pure (trimQueryEnd (_nqmCode nq)) -- for now, all queries are valid
validateStoredProcedure _ _ _ _ = pure () -- for now, all stored procedures are valid
getStoredProcedureGraphqlName = MSSQL.getStoredProcedureGraphqlName