Commit Graph

3040 Commits

Author SHA1 Message Date
Tom Harding
2c5e89e5d8 Fix array relationship aliasing (good news)
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9438
Co-authored-by: Daniel Harvey <4729125+danieljharvey@users.noreply.github.com>
GitOrigin-RevId: 14b225ad8c834f2aa9863cee951d39f203046282
2023-06-06 17:21:05 +00:00
Daniel Harvey
0c38a693ac chore(ci): Use hlint github action
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9434
GitOrigin-RevId: 2205da4c6384b89d31f830a5119514154019566d
2023-06-06 16:00:22 +00:00
Brandon Simmons
440a8664de server: Upgrade the HGE server to GHC 9.4.5
Upgrade to GHC 9.4.5, and update any tests.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8954
Co-authored-by: Mohd Bilal <24944223+m-Bilal@users.noreply.github.com>
Co-authored-by: Samir Talwar <47582+SamirTalwar@users.noreply.github.com>
Co-authored-by: Philip Lykke Carlsen <358550+plcplc@users.noreply.github.com>
GitOrigin-RevId: 5261126777cb478567ea471c4bf5441bc345ea0d
2023-06-06 13:29:30 +00:00
Karthikeyan Chinnakonda
a0b2f29b93 server: generate streaming subscription field only when there is at least one cursor column accessible
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9399
Co-authored-by: Auke Booij <164426+abooij@users.noreply.github.com>
GitOrigin-RevId: bd7f3fe3e95609c1634d531b95981c8ba15fba4e
2023-06-06 12:04:47 +00:00
Daniel Harvey
e7929f9661 chore(hedis): replace missing test/Main.hs
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9431
GitOrigin-RevId: 24ddc07a7036ed3032fafebe3b39c698caf08ae0
2023-06-06 09:48:40 +00:00
Anon Ray
05862a4327 server: store collected source introspection to DB
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9237
Co-authored-by: Puru Gupta <32328846+purugupta99@users.noreply.github.com>
GitOrigin-RevId: 77327742db2f8440fdf770db5ae1c034cbb06e3b
2023-06-06 08:51:51 +00:00
Gil Mizrahi
15ce5196d0 throw an error on non-existing source in get_logical_model / get_native_query
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9421
GitOrigin-RevId: 2839e587c2966aa4580a631c3eff389c98b275df
2023-06-05 15:17:24 +00:00
Daniel Harvey
0aeb48992e chore(testing): index all queries for Native Query tests by backend type
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9416
GitOrigin-RevId: 7b10bd1f8e2cbb98ec86646d9f54b18ad42bf85c
2023-06-05 13:06:03 +00:00
Puru Gupta
328b7b793f server: add support for redis clusters
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8867
Co-authored-by: paritosh-08 <85472423+paritosh-08@users.noreply.github.com>
GitOrigin-RevId: 6ab173b02f6b8bf97ccbcdb00110fe147771c751
2023-06-05 12:11:59 +00:00
Daniel Harvey
776a893eaa chore(server): non-nullable native query object relationships for SQLServer
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9405
GitOrigin-RevId: eda4fb38c9abc4a5d631964b8f80928d545a3694
2023-06-05 09:26:47 +00:00
Gil Mizrahi
d8a4d254f6 chore(tests): add a flag to trace the graphql commands sent to the server during a test.
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9409
GitOrigin-RevId: 46d0c48b519bf32ddb9869a8a7af81aad302532b
2023-06-05 08:22:53 +00:00
Lyndon Maydwell
6487a44546 Adding function permissions to UDFs for Dataconnectors
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9349
GitOrigin-RevId: 0b71d06a13ad78a55a205a5755260b060525d340
2023-06-05 05:29:53 +00:00
Daniel Harvey
22ff735370 chore(server): non-nullable native query object relationships for BigQuery
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9361
GitOrigin-RevId: e2af5f1a9761da7346d5913fcb25305dce378a7b
2023-06-02 15:20:10 +00:00
Daniel Chambers
e2345fb3bb Fixes to HTTP request recording in the Data Connector agent test suite
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9394
GitOrigin-RevId: 873dc4e8ec744013f8303d197a91ec499e6a9c66
2023-06-02 14:34:49 +00:00
Sameer Kolhar
f04d2950f2 server: remove "__" prefixed types for schema-registry in the GQL Introspection
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9339
GitOrigin-RevId: d6d098ab8e126d0d64a83e3ddb0d22eb512b2d60
2023-06-02 12:46:59 +00:00
Tom Harding
b124c943a9 chore(server): allow recursive native queries
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9373
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
Co-authored-by: Daniel Harvey <4729125+danieljharvey@users.noreply.github.com>
GitOrigin-RevId: b998da0e2725f687a00c2c6c993435e44df4f70f
2023-06-02 10:37:55 +00:00
Samir Talwar
dd46aa6715 server: Preserve ordering when possible, and sort when it's not.
When upgrading to GHC v9.4, we noticed a number of failures because the sort order of HashMaps has changed. With this changeset, I am endeavoring to mitigate this now and in the future.

This makes one of two changes in a few areas where we depend on the sort order of elements in a `HashMap`:

  1. the ordering of the request is preserved with `InsOrdHashMap`, or
  2. we sort the data after retrieving it.

Fortunately, we do not do this anywhere where we _must_ preserve order; it's "just" descriptions, error messages, and OpenAPI metadata. The main problem is that tests are likely to fail each time we upgrade GHC (or whatever is providing the hash seed).

[NDAT-705]: https://hasurahq.atlassian.net/browse/NDAT-705?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9390
GitOrigin-RevId: 84503e029b44094edbbc298651744bc2843c15f3
2023-06-02 09:31:26 +00:00
Daniel Chambers
d421cdb726 Put the message property first when encoding error JSON
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9379
GitOrigin-RevId: 385035810190786f54a1db86e3a2e4a2c3bd5dee
2023-06-02 05:29:50 +00:00
Daniel Harvey
0034ae8892 chore(server): use new version of sandwich
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9386
Co-authored-by: Daniel Chambers <1214352+daniel-chambers@users.noreply.github.com>
GitOrigin-RevId: 008312c7550025cb44d515fa3d01796175b60e29
2023-06-02 02:00:41 +00:00
Rakesh Emmadi
427ca18e85 server: collect remote schema and database introspections while building schema cache
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9297
GitOrigin-RevId: 143f50be2eba382d129669e26ef3a7eb24c921ca
2023-06-01 16:34:31 +00:00
kodiakhq[bot]
34e172d576 chore(tooling): import ci-info-hs into monorepo
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9383
Co-authored-by: Shahidh K Muhammed <4124733+shahidhk@users.noreply.github.com>
Co-authored-by: Ajeet D'Souza <1777663+ajeetdsouza@users.noreply.github.com>
Co-authored-by: Brandon Simmons <210815+jberryman@users.noreply.github.com>
Co-authored-by: Vamshi Surabhi <6562944+0x777@users.noreply.github.com>
Co-authored-by: Auke Booij <164426+abooij@users.noreply.github.com>
Co-authored-by: Matthew Pickering <1216657+mpickering@users.noreply.github.com>
Co-authored-by: Antoine Leblanc <1618949+nicuveo@users.noreply.github.com>
GitOrigin-RevId: a7a210e2237f5adc63302b18403616c7c0aa39ca
2023-06-01 12:51:39 +00:00
Vishnu Bharathi
af6795da93 ci: tag release v2.11.7
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9385
GitOrigin-RevId: 72df47dfb1a55677843d43a9db7d39036d31a829
2023-06-01 11:57:26 +00:00
Gil Mizrahi
b87506e87c chore(tests): output hge stderr in api-tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9384
GitOrigin-RevId: 5d78b59e12bf870a3cba81829dcf4d3e0d2aebf9
2023-06-01 11:43:38 +00:00
Gil Mizrahi
3ce1b414b4 NativeQueries: validate that there are no unused or undeclare arguments
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9357
GitOrigin-RevId: 9d0ac74c8a2780c6d1b3e7769c3d4775bacb2d8d
2023-06-01 09:15:48 +00:00
Philip Lykke Carlsen
df10ccf310 fix(pg): Support aliased fields for Native Query object relations
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9374
GitOrigin-RevId: 073e51480e2be97e32938fa61a3547374e04ead8
2023-05-31 15:42:50 +00:00
Philip Lykke Carlsen
363e158bc4 refactor: Rename 'Provenance(Unknown)' to 'Provenance(FreshVar)'
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9376
GitOrigin-RevId: 3ef6572208ebc7770549d2b1cee16eb5086b56cf
2023-05-31 13:45:48 +00:00
Daniel Harvey
7d011644ac chore(server): allow non-nullable NQ -> NQ object relationships
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9353
GitOrigin-RevId: 9da95675d224f3045509592c2515b7afa2500d00
2023-05-31 10:34:28 +00:00
Vishnu Bharathi
7ecf9dafeb ci: tag release v2.27.0-beta.1
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9369
GitOrigin-RevId: 5dc966791905d9e6d0db6bccb79b424b58049ea8
2023-05-31 08:28:53 +00:00
Daniel Chambers
bfd046b224 Add additional tracing spans to HGE GraphQL queries and the Super Connector
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9332
GitOrigin-RevId: ecde2383a42acf93fa8c6abb8bbd4c3b074b77fb
2023-05-31 05:49:12 +00:00
Daniel Harvey
9de3db4729 chore(server): respect logical model array nullability
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9303
GitOrigin-RevId: 4d38a125a6889e2b0be34905e21a78036a77881e
2023-05-31 00:15:47 +00:00
David Overton
26dfa3e718 Replace TableObjectType, etc. with the corresponding Logical Model types
## Description

This is the first step in making use of Logical Models with document databases such as MongoDB. As part of schema introspection, a data connector agent can supply a set of custom types that can be used to describe the schema for columns within the tables of the database (or _fields_ within a _document collection_ in MongoDB terminology).

Previously, we were storing these custom types as `TableObjectType`s within the `TableCoreInfo` for each table.

In this PR we
- replace the `TableObjectTypes` with `LogicalModel` types
- store these directly within the `DBObjectsIntrospection` instead of within the `TableCoreInfo` for each table. (The custom types are shared at the source level so there was no reason to have a separate set of types for each table.)
- When building the `SourceInfo`, we combine the `LogicalModel`s from `DBObjectsIntrospection` with `LogicalModel`s from the user's metadata to create the set of `LogicalModels` in the `SourceInfo` within the `SchemaCache`. I.e. we combine the set of types obtained by database introspection with the set of types specified by the user in the metadata. If two types have the same name, we use the type defined in the metadata.

## Limitations and future work

- Provide a way for the user to associate a meta-data defined `LogicalModel` with a table instead of requiring one to be provided by DB introspection
- Provide a way for the user to edit the  `LogicalModel` types provided by introspection and add them to the metadata.
- Allow a `LogicalModel` object type to describe and entire table rather than just individual columns.
- Better handling for "unknown" types, e.g. if the type of a collection (or part of a collection) is unknown we should treat it as a JSON scalar value. This may also involve adding an `_everything` field which returns the full document as a JSON scalar.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9345
GitOrigin-RevId: 5cec72fc1be1380d8600f7be547bbf71aad770bd
2023-05-30 14:05:46 +00:00
Gil Mizrahi
2c3663b706 Catch ErrorCall in runHandler and expose it as a message with status 200
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9340
GitOrigin-RevId: b18fe167c8d26027d70da239606bd66d61e9bb43
2023-05-30 12:32:45 +00:00
Gil Mizrahi
7c1ab39637 bugfix: quote columns in postgres nq validation
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9337
GitOrigin-RevId: e8e4c23efe9e3a028596f485d8e6f966b0c1a30a
2023-05-29 12:40:40 +00:00
ananya-2410
3303690fc4 ci: tag release v2.26.0
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9336
GitOrigin-RevId: bbbae990f9d39941a4fbc25d24227738522298c1
2023-05-29 11:26:37 +00:00
Karthikeyan Chinnakonda
318bffa28d Fix performance regression introduced in #8922
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9310
Co-authored-by: Sameer Kolhar <6604943+kolharsam@users.noreply.github.com>
Co-authored-by: paritosh-08 <85472423+paritosh-08@users.noreply.github.com>
GitOrigin-RevId: 82697ea7d0f4a5cc39f05938f92a7ba49d9b6098
2023-05-29 07:06:18 +00:00
Philip Lykke Carlsen
cce7239da3 feat(BigQuery): Add object relationship support for Native Queries
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9302
GitOrigin-RevId: 9bf623bdbca33a5919f3c7834d9b6605119fa8cb
2023-05-25 16:15:38 +00:00
Daniel Harvey
39396c50b8 feature(server): comparable computed field aggregations for Postgres
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9300
GitOrigin-RevId: 92e4afaf2c029304e9ddb1d9541aa78c2b9b3027
2023-05-25 12:55:29 +00:00
Daniel Harvey
090a41ebf4 Move Logical Model parsers to Hasura.LogicalModel.Schema
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9298
GitOrigin-RevId: 8a4fdff7381495c94eede9d91437b635c8a60eac
2023-05-25 12:30:32 +00:00
Tom Harding
3492484034 Implement get_table_info for Postgres, Citus, and Cockroach
[NDAT-621]: https://hasurahq.atlassian.net/browse/NDAT-621?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9201
GitOrigin-RevId: 91886f5f8d125d49c35647cfbfc3c6621d932761
2023-05-25 09:32:12 +00:00
Daniel Chambers
7e4c24aea0 Fix WebSockets api-tests breaking for Data Connector backends
[GDC-1024]: https://hasurahq.atlassian.net/browse/GDC-1024?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9291
GitOrigin-RevId: f7a2306268fc1a22744dd9393ac17648551434b0
2023-05-25 07:06:28 +00:00
Lyndon Maydwell
bd513ea704 Adding functionCommands to DC API for UDF Incrementaion Function APIs
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9288
Co-authored-by: Brandon Martin <40686+codedmart@users.noreply.github.com>
GitOrigin-RevId: b7242146480ff38a53cfdf95b1a44d44cbd37c5b
2023-05-24 22:36:25 +00:00
Gil Mizrahi
209fec7bb1 fix: nq relationships - throw an error instead on unexpected relationship
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9282
GitOrigin-RevId: 82ffda0d93de976181bae7befa9b62868355cd16
2023-05-24 14:37:57 +00:00
Tom Harding
e0c0043e76 Upgrade Ormolu to 0.7.0.0
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9284
GitOrigin-RevId: 2f2cf2ad01900a54e4bdb970205ac0ef313c7e00
2023-05-24 13:53:53 +00:00
Krushan Bauva
e3df24507d server: add dynamic labels trigger_name and source_name to existing event trigger metrics
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9265
GitOrigin-RevId: 6fb6504f1a476ea6c8b810e067770920757e8dc6
2023-05-24 13:23:43 +00:00
Sameer Kolhar
6d27ad97ae server: send request to schema_registry service every time the GQL schema is updated
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8922
Co-authored-by: Naveen Naidu <30195193+Naveenaidu@users.noreply.github.com>
GitOrigin-RevId: a0f3b0c2b2d039e9137ff816b41611e239ed2201
2023-05-24 12:51:19 +00:00
David Overton
e5f88d8039 Nested array support for Data Connectors Backend and MongoDB
## Description

This change adds support for querying into nested arrays in Data Connector agents that support such a concept (currently MongoDB).

### DC API changes

- New API type `ColumnType` which allows representing the type of a "column" as either a scalar type, an object reference or an array of `ColumnType`s. This recursive definition allows arbitrary nesting of arrays of types.
- The `type` fields in the API types `ColumnInfo` and `ColumnInsertSchema` now take a `ColumnType` instead of a `ScalarType`.
- To ensure backwards compatibility, a `ColumnType` representing a scalar serialises and deserialises to the same representation as `ScalarType`.
- In queries, the `Field` type now has a new constructor `NestedArrayField`. This contains a nested `Field` along with optional `limit`, `offset`, `where` and `order_by` arguments. (These optional arguments are not yet used by either HGE or the MongoDB agent.)

### MongoDB Haskell agent changes

- The `/schema` endpoint will now recognise arrays within the JSON validation schema and generate corresponding arrays in the DC schema.
- The `/query` endpoint will now handle `NestedArrayField`s within queries (although it does not yet handle `limit`, `offset`, `where` and `order_by`).

### HGE server changes

- The `Backend` type class adds a new type family `XNestedArrays b` to enable nested arrays on a per-backend basis (currently enabled only for the `DataConnector` backend.
- Within `RawColumnInfo` the column type is now represented by a new type `RawColumnType b` which mirrors the shape of the DC API `ColumnType`, but uses `XNestedObjects b` and `XNestedArrays b` type families to allow turning nested object and array supports on or off for a particular backend. In the `DataConnector` backend `API.CustomType` is converted into `RawColumnInfo 'DataConnector` while building the schema.
- In the next stage of schema building, the `RawColumnInfo` is converted into a `StructuredColumnInfo` which allows us to represent the three different types of columns: scalar, object and array. TODO: the `StructuredColumnInfo` looks very similar to the Logical Model types. The main difference is that it uses the `XNestedObjects` and `XNestedArrays` type families. We should be able to combine these two representations.
- The `StructuredColumnInfo` is then placed into a `FIColumn` `FieldInfo`. This involved some refactoring of `FieldInfo` as I had previously split out `FINestedObject` into a separate constructor. However it works out better to represent all "column" fields (i.e. scalar, object and array) using `FIColumn` as this make it easier to implement permission checking correctly. This is the reason the `StructuredColumnInfo` was needed.
- Next, the `FieldInfo` are used to generate `FieldParser`s. We add a new constructor to `AnnFieldG` for `AFNestedArray`. An `AFNestedArray` field parser can contain either a simple array selection or an array aggregate. Simple array `FieldParsers` are currently limited to subfield selection. We will add support for limit, offset, where and order_by in a future PR. We also don't yet generate array aggregate `FieldParsers.
- The new `AFNestedArray` field is handled by the `QueryPlan` module in the `DataConnector` backend. There we generate an `API.NestedArrayField` from the AFNestedArray. We also handle nested arrays when reshaping the response from the DC agent.

## Limitations

- Support for limit, offset, filter (where) and order_by is not yet fully implemented, although it should not be hard to add this
- Support for aggregations on nested arrays is not yet fully implemented
- Permissions involving nested arrays (and objects) not yet implemented
- This should be integrated with Logical Model types, but that will happen in a separate PR

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9149
GitOrigin-RevId: 0e7b71a994fc1d2ca1ef73bfe7b96e95b5328531
2023-05-24 08:02:43 +00:00
Daniel Chambers
f77b6aaa1d Data Connectors: Support using array literals in permission checks
[GDC-868]: https://hasurahq.atlassian.net/browse/GDC-868?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9238
GitOrigin-RevId: 93593f79a4a6a92eec1d0dc10fd8e5bb21bd123e
2023-05-24 04:42:02 +00:00
Divi
318f297e82 server: collect oss resource usage metrics
[INFRA-867]: https://hasurahq.atlassian.net/browse/INFRA-867?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9240
GitOrigin-RevId: bafe69b96e8f44c8030a4c219bd84206faeb85f5
2023-05-24 02:44:12 +00:00
Lyndon Maydwell
4a38055e9e Adding default table return type to fibs functions in UDF API tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9270
GitOrigin-RevId: a08e991e60893aa18b370652fc993b437797ed3c
2023-05-23 23:23:54 +00:00
Puru Gupta
46451cf114 server: fetch and use stored introspection during Schema Cache (re)builds
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9272
GitOrigin-RevId: 08d7767489912ca1420453f5dda0e440352a19c0
2023-05-23 21:05:19 +00:00