Commit Graph

1142 Commits

Author SHA1 Message Date
Abby Sassel
745ff91dcd server/docs: Add reference in test to its related issue
I got sad that I didn't write a line of code (or...comments) today, so here we are 😅 also [I said I would](https://github.com/hasura/graphql-engine/issues/7181#issuecomment-877143240).

FYI @aniketd this is our convention for linking bug fixes to issues

https://github.com/hasura/graphql-engine-mono/pull/1777

GitOrigin-RevId: 11ee6cc52903c074dc3b6fa8b8c3636cca94174d
2021-07-12 18:59:50 +00:00
Rakesh Emmadi
a375f8c105 server/postgres: Support scalar computed fields in remote joins
https://github.com/hasura/graphql-engine-mono/pull/1692

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
GitOrigin-RevId: fcef85910899859f7421cad554c022f8023965ea
2021-07-12 16:04:37 +00:00
Antoine Leblanc
0a9382f2dc [gardening] remove Alias from Backend
### Description

In our haste to generalize everything for MSSQL, we put every single "suspicious" type in Backend, including ones that weren't required. `Alias` is one of those: it's only used in a type alias, and is actually just an implementation detail of the translation layer. This PR removes it.

https://github.com/hasura/graphql-engine-mono/pull/1759

GitOrigin-RevId: fb348934ec65a51aae7f95d93c83c3bb704587b5
2021-07-09 15:54:56 +00:00
Aniket Deshpande
66f09eeaab MSSQL nodes aggregates & inherited roles
https://github.com/hasura/graphql-engine-mono/pull/1293

Co-authored-by: Chris Done <11019+chrisdone@users.noreply.github.com>
Co-authored-by: Abby Sassel <3883855+sassela@users.noreply.github.com>
GitOrigin-RevId: 776402dbbaf3d8166a62b1aaaf6abc7e584b3eb2
2021-07-08 20:50:09 +00:00
Philip Lykke Carlsen
7784c72d70 Pytest: Pretty-print JSON payloads in failing assertions
I finally got fed up trying to decipher the messages from failing assertions in integration tests and was thus spurred into action :-)

Instead of using the `repr(..)` format for the `OrderedDict`s of query responses we now deliberately format them as JSON with indentation.

https://github.com/hasura/graphql-engine-mono/pull/1751

GitOrigin-RevId: 1ca0d03ff52950095b89b447d9625d6481bc7177
2021-07-08 19:29:40 +00:00
Brandon Simmons
8306a4d1e4 Add initial benchmark suite, running in CI (closes hasura/graphql-engine-mono#736)
https://github.com/hasura/graphql-engine-mono/pull/1742

GitOrigin-RevId: 17ccd836171f6f39e808f8ac0f28da5cf8ef8f27
2021-07-08 18:19:51 +00:00
Antoine Leblanc
d91029ad51 [gardening] remove all traverse functions from RQL.IR
### Description

This PR removes all `fmapX` and `traverseX` functions from RQL.IR, favouring instead `Functor` and `Traversable` instances throughout the code. This was a relatively straightforward change, except for two small pain points: `AnnSelectG` and `AnnInsert`. Both were parametric over two types `a` and `v`, making it impossible to make them traversable functors... But it turns out that in every single use case, `a ~ f v`. By changing those types to take such an `f :: Type -> Type` as an argument instead of `a :: Type` makes it possible to make them functors.

The only small difference is for `AnnIns`, I had to introduce one `Identity` transformation for one of the `f` parameters. This is relatively straightforward.

### Notes

This PR fixes the most verbose BigQuery hint (`let` instead of `<- pure`).

https://github.com/hasura/graphql-engine-mono/pull/1668

GitOrigin-RevId: e632263a8c559aa04aeae10dcaec915b4a81ad1a
2021-07-08 15:42:53 +00:00
Rakesh Emmadi
e567a096e6 server/postgres: support computed fields in query filters ('where' expression)
https://github.com/hasura/graphql-engine-mono/pull/1677

GitOrigin-RevId: 30175a442237f6ac4b112c652f448a635ad90dc6
2021-07-07 11:59:32 +00:00
Robert
ae6d624441 server: improve handling of HTTP client errors for remote schema calls
https://github.com/hasura/graphql-engine-mono/pull/1719

GitOrigin-RevId: 5ff671bcff5f0559b9821f8359ebee4129f4b664
2021-07-07 10:15:05 +00:00
Antoine Leblanc
80161e4208 server: delegate Metadata API parsing to a new backend class
https://github.com/hasura/graphql-engine-mono/pull/1179

Co-authored-by: Abby Sassel <3883855+sassela@users.noreply.github.com>
Co-authored-by: Tirumarai Selvan <8663570+tirumaraiselvan@users.noreply.github.com>
GitOrigin-RevId: b565de269e215ae8172bddd895f3d057ddcc8695
2021-07-07 01:44:41 +00:00
Abby Sassel
76c322589c server/bigquery: Document BigQuery integration tests
This PR documents & streamlines how we run BigQuery integration tests locally as a first step to [running them in CI](https://github.com/hasura/graphql-engine-mono/issues/1525).

I've also created a hasura service account for internal use. [Internal docs here](https://github.com/hasura/graphql-engine-mono/wiki/Testing-BigQuery).

Thanks to FP Complete team for [the guidance here](https://docs.google.com/document/d/1dGDK0touUtsDxRQPonMxSoPbIfzBoSYo02tAjQEO7qA/edit?ts=60c0cf24#), which I've reused parts of.

https://github.com/hasura/graphql-engine-mono/pull/1732

GitOrigin-RevId: 303819d212aa073fbef685d077b1cfa583cd15fc
2021-07-06 11:13:06 +00:00
Chris Done
614c0dab80 Bigquery/fix limit offset for array aggregates
Blocked on https://github.com/hasura/graphql-engine-mono/pull/1640.

While fiddling with BigQuery I noticed a severe issue with offset/limit for array-aggregates. I've fixed it now.

The basic problem was that I was using a query like this:

```graphql
query MyQuery {
  hasura_Artist(order_by: {artist_self_id: asc}) {
    artist_self_id
    albums_aggregate(order_by: {album_self_id: asc}, limit: 2) {
      nodes {
        album_self_id
      }
      aggregate {
        count
      }
    }
  }
}
```

Producing this SQL:

```sql
SELECT `t_Artist1`.`artist_self_id` AS `artist_self_id`,
       STRUCT(IFNULL(`aa_albums1`.`nodes`, NULL) AS `nodes`, IFNULL(`aa_albums1`.`aggregate`, STRUCT(0 AS `count`)) AS `aggregate`) AS `albums_aggregate`
FROM `hasura`.`Artist` AS `t_Artist1`
LEFT OUTER JOIN (SELECT ARRAY_AGG(STRUCT(`t_Album1`.`album_self_id` AS `album_self_id`) ORDER BY (`t_Album1`.`album_self_id`) ASC) AS `nodes`,
                        STRUCT(COUNT(*) AS `count`) AS `aggregate`,
                        `t_Album1`.`artist_other_id` AS `artist_other_id`
                 FROM (SELECT *
                       FROM `hasura`.`Album` AS `t_Album1`
                       ORDER BY (`t_Album1`.`album_self_id`) ASC NULLS FIRST
                       -- PROBLEM HERE
                       LIMIT @param0) AS `t_Album1`
                 GROUP BY `t_Album1`.`artist_other_id`)
AS `aa_albums1`
ON (`aa_albums1`.`artist_other_id` = `t_Artist1`.`artist_self_id`)
ORDER BY (`t_Artist1`.`artist_self_id`) ASC NULLS FIRST
```

Note the `LIMIT @param0` -- that is incorrect because we want to limit
per artist. Instead, we want:

```sql
SELECT `t_Artist1`.`artist_self_id` AS `artist_self_id`,
       STRUCT(IFNULL(`aa_albums1`.`nodes`, NULL) AS `nodes`, IFNULL(`aa_albums1`.`aggregate`, STRUCT(0 AS `count`)) AS `aggregate`) AS `albums_aggregate`
FROM `hasura`.`Artist` AS `t_Artist1`
LEFT OUTER JOIN (SELECT ARRAY_AGG(STRUCT(`t_Album1`.`album_self_id` AS `album_self_id`) ORDER BY (`t_Album1`.`album_self_id`) ASC) AS `nodes`,
                        STRUCT(COUNT(*) AS `count`) AS `aggregate`,
                        `t_Album1`.`artist_other_id` AS `artist_other_id`
                 FROM (SELECT *,
                            -- ADDED
                            ROW_NUMBER() OVER(PARTITION BY artist_other_id) artist_album_index
                       FROM `hasura`.`Album` AS `t_Album1`
                       ORDER BY (`t_Album1`.`album_self_id`) ASC NULLS FIRST
                       ) AS `t_Album1`
                 -- CHANGED
                 WHERE artist_album_index <= @param
                 GROUP BY `t_Album1`.`artist_other_id`)
AS `aa_albums1`
ON (`aa_albums1`.`artist_other_id` = `t_Artist1`.`artist_self_id`)
ORDER BY (`t_Artist1`.`artist_self_id`) ASC NULLS FIRST
```

That serves both the LIMIT/OFFSET function in the where clause. Then,
both the ARRAY_AGG and the COUNT are correct per artist.

I've updated my Haskell test suite to add regression tests for this. I'll push a commit for Python tests shortly. The tests still pass there.

This just fixes a case that we hadn't noticed.

https://github.com/hasura/graphql-engine-mono/pull/1641

GitOrigin-RevId: 49933fa5e09a9306c89565743ecccf2cb54eaa80
2021-07-06 08:29:39 +00:00
Antoine Leblanc
6ed800abaa [gardening] Introduce PartialArbitrary
### Context

One of the ways we use the Backend type families is to use `Void` for all types for which a backend has no representation; this allows us to make some branches of our metadata and IR unrepresentable, making some functions total, where they would have to handle those unsupported cases otherwise.

However, one of the biggest features, functions, cannot be cut that way, due to one of the constraints on `FunctionName b`: the metadata generator requires it to have an `Arbitrary` instance, and `Arbitrary` does not have a recovery mechanism which would allow for a `Void` instance...

### Description

This PR solves this problem and removes the `Arbitrary` constraints in `Backend`. To do so, it introduces a new typeclass: `PartialArbitrary`, which is very similar to `Arbitrary`, except that it returns a `Maybe (Gen a)`, allowing for `Void` to have a well-formed instance. An `Arbitrary` instance for `Metadata` can easily be retrieved with `arbitrary = fromJust . partialArbitrary`.

Furthermore, `PartialArbitrary` has a generic implementation, inspired by the one in `generic-arbitrary`, which automatically prunes branches that return `Nothing`, allowing to automatically construct most types. Types that don't have a type parameter and therefore can't contain `Void` can easily get their `PartialArbitrary` instance from `Arbitrary` with `partialArbitrary = Just arbitrary`. This is what a default overlappable instance provides.

In conjunction with other cleanups in #1666, **this allows for Void function names**.

### Notes

While this solves the stated problem, there are other possible solutions we could explore, such as:
- switching from QuickCheck to a library that supports that kind of pruning natively
- removing the test altogether, and dropping all notion of Arbitrary from the code

There are also several things we could do with the Generator module:
- move it out of RQL.DDL.Metadata, to some place that makes more sense
- move ALL Arbitrary instances in the code to it, since nothing else uses Arbitrary
- or, to the contrary, move all those Arbitrary instances alongside their types, to avoid an orphan instance

https://github.com/hasura/graphql-engine-mono/pull/1667

GitOrigin-RevId: 88e304ea453840efb5c0d39294639b8b30eefb81
2021-07-05 22:04:38 +00:00
Antoine Leblanc
c64f66774b [gardening] remove ToJSON constraint in spockAction (fix #1581)
### Description

The spock handler requires the request type to have a `ToJSON` instance AND a `FromJSON` instance. That's because we parse it from the received bytestring into its proper type.... and call `toJSON` on it to log it. This PR simplifies this, by keeping the intermediate `Value` obtained during parsing, and using it for logging. This has two consequences:

1. it removes the `ToJSON` constraint, which will remove some code down the line (esp. in Metadata)
2. it means we log the actual JSON object query we received, not the result of parsing it, meaning the logged object will contain fields that would have been ignored when parsing the actual value; this is both an upside (more accurate log) and a downside (could be more verbose / more confusing)

### Further work

Should this PR also remove all obsolete ToJSON instances while at it?
How do we test this?

https://github.com/hasura/graphql-engine-mono/pull/1664

GitOrigin-RevId: ae099eea9a671eabadcdf507f993a5ad9433be87
2021-07-05 18:47:55 +00:00
Swann Moreau
f6e49500d5 server: log request type (batched/single) in http-log
https://github.com/hasura/graphql-engine-mono/pull/1488

GitOrigin-RevId: 092335d6eb95224b8ed81d853a71fca01379dd7d
2021-07-05 09:46:29 +00:00
Robert
5cc91aebc3 server: Log action and event names (close #1603)
- add name fields to log output in several spots:
  - action logs get the action name in detail.action_name
  - events (triggered and scheduled) get the trigger name in detail.event_name
  - one-off scheduled events don't have a trigger name; instead, they get the
    comment if it exists
- remove unused event creation timestamp from ExtraLogContext

https://github.com/hasura/graphql-engine-mono/pull/1712

GitOrigin-RevId: 28907340d4e2d9adc0c48cc5d3010eef1fa902e1
2021-07-05 07:48:39 +00:00
Robert
a7a4791b96 server/eventing: clean-up around logging configuration
- Add export list to Hasura.Eventing.Common
- Group logging options in one type / argument
- Group request header processing code in one place
  This doesn't address the convoluted logic, but should make it a bit easier
  to figure out what's going on for the next person.

https://github.com/hasura/graphql-engine-mono/pull/1710

GitOrigin-RevId: 34b0abdd1b86b5836eb512484acb0db8c81f3014
2021-07-02 17:25:59 +00:00
Anon Ray
f263af31a0 server: add query field to http-log and websocket-log
https://github.com/hasura/graphql-engine-mono/pull/1683

GitOrigin-RevId: 6f46e31bb14f135d528b20ae9513e393c06c3c8a
2021-07-02 13:05:57 +00:00
Karthikeyan Chinnakonda
43973f80cf server tests: refactor the per_class_tests_db_state fixture
https://github.com/hasura/graphql-engine-mono/pull/1701

GitOrigin-RevId: 278b9e226cc7719f4c44bf9c9a802146a8a004f4
2021-07-01 09:21:45 +00:00
Swann Moreau
4929f83c71 server: reorganise version embedding for fewer [TH] rebuilds
https://github.com/hasura/graphql-engine-mono/pull/1682

GitOrigin-RevId: 6575f7bba20b75c48c5bc6d60e9379dc443aeaa0
2021-06-29 16:40:47 +00:00
Antoine Leblanc
404551acdb server: fix major issue with JSON instances of AnyBackend
### Description
This PR fixes a major issue in the JSON instances of `AnyBackend`: they were not symmetrical! `FromJSON` always made the assumption that the value was an object, and that it contained a "kind" field if it happened to not be a Postgres value. `ToJSON` did NOT insert said field in the output, and did not enforce that the output was an object.

....however, it worked, because nowhere in the code did we yet rely on those being symmetrical. They are both used only once:
- `parseJSON` was used to decode a `Metadata` object, but the matching `toJSON` instance, which is heavily customized, does insert the "kind" field properly
- `toJSON` was only used on the `SchemaCache`, which has no corresponding `FromJSON` instance, since we only serialize it in debug endpoints

This PR makes no attempt at making the instances symmetrical. Instead, it implements simpler functions, and pushes the problem of identifying the proper backend (if any) to the call sites.

### Notes

Additionally, it cleans up some instances that were manually written where they could be auto-generated. In the process, this PR changes the semantics of `Show`, since the stock derived instance will include the constructor name, where before it was skipped. I think it is preferable.

https://github.com/hasura/graphql-engine-mono/pull/1672

GitOrigin-RevId: 0a1580a0e0f01c25b8c9fee7612dba6e7de055d5
2021-06-28 18:39:01 +00:00
Chris Done
27223fb102 Bigquery/drop dataloader
Blocked on https://github.com/hasura/graphql-engine-mono/pull/1592.

This drops the unused data loader code. There should be no function change, so no new tests are added.

https://github.com/hasura/graphql-engine-mono/pull/1640

GitOrigin-RevId: 6589a69493dc3d2ea119e6ee04622fc94024403b
2021-06-28 13:30:40 +00:00
Chris Done
6dc555f9eb Bigquery/global limit
This resolves https://github.com/hasura/graphql-engine/issues/6947.

A new [`global_select_limit`](b0ab5deefe/server/tests-py/queries/graphql_query/bigquery/replace_metadata.yaml (L17)) field is supported in the BigQuery configuration.

To test global limits, we have two sources defined,  the normal one (limited to 1million) and one with a limit of 1.

https://github.com/hasura/graphql-engine-mono/pull/1592

GitOrigin-RevId: 6ebcc7c1a16bc26ec36e53ae3694d36b7ce5c6e1
2021-06-25 13:36:35 +00:00
kodiakhq[bot]
a11b4135fc Use exceptions to handle compatibility with pg 9.6 in 2.0 upgrade migration
https://github.com/hasura/graphql-engine-mono/pull/1651

Co-authored-by: Rakesh Emmadi <12475069+rakeshkky@users.noreply.github.com>
Co-authored-by: Brandon Simmons <210815+jberryman@users.noreply.github.com>
GitOrigin-RevId: cdb4a33cbb1a136bc30e8f0dd59aaae584d3a636
2021-06-24 02:20:11 +00:00
Tirumarai Selvan
345cf8fe4c tag release v2.0.1
GitOrigin-RevId: f33aca9566de9cb6e2fe9fa7a94e7d64d06d3ef4
2021-06-23 18:10:07 +00:00
Rakesh Emmadi
13bedf5821 server/postgres: fix resetting the metadata catalog version to 43 while initializing postgres source with 1.0 catalog (#1645)
* fix resetting the catalog version to 43 on migration from 1.0 to 2.0

* ci: remove applying patch in test_oss_server_upgrade job

* make the 43 to 46th migrations idempotent

* Set missing HASURA_GRAPHQL_EVENTS_HTTP_POOL_SIZE=8 in upgrade_test

It's not clear why this wasn't caught in CI.

* ci: disable one component of event backpressure test

Co-authored-by: Vishnu Bharathi P <vishnubharathi04@gmail.com>
Co-authored-by: Karthikeyan Chinnakonda <karthikeyan@hasura.io>
Co-authored-by: Brandon Simmons <brandon@hasura.io>
GitOrigin-RevId: c74c6425266a99165c6beecc3e4f7c34e6884d4d
2021-06-23 18:01:09 +00:00
Tirumarai Selvan
1f2470289f tag release v2.0.0
GitOrigin-RevId: ea05a42fdc33008ef177b3c459e1d148aa05f113
2021-06-23 08:35:05 +00:00
Solomon Bothwell
6c48babc95 Adds integration test for caching remote schema queries
https://github.com/hasura/graphql-engine-mono/pull/1613

GitOrigin-RevId: 54eb9dec54ed00079f10d057d41bb29e73d9f68e
2021-06-22 21:11:02 +00:00
Sameer Kolhar
608e4fbb20 server, console, docs: add update_remote_schema API
https://github.com/hasura/graphql-engine-mono/pull/1546

GitOrigin-RevId: 142b0d0e0ffc35b2679c91c411868c45a8b8e221
2021-06-21 17:42:40 +00:00
Sameer Kolhar
c425b77e2d server: fix regression in action responses where aliased fields are dropped
https://github.com/hasura/graphql-engine-mono/pull/1612

GitOrigin-RevId: a031ec2e9fa15df6394382befd9a0db759ef5213
2021-06-21 12:12:07 +00:00
jkachmar
9b71a1d413 server: Updates 'pg-client-hs', fixes explicit conversions
Previous versions of 'pg-client-hs' provided a Template Haskell splice
'sqlFromFile' which returned compile-time embedded PostgreSQL queries.

Rather than returning a concrete 'Query', however, this function
returned the polymorphic 'IsString txt => txt' which allowed the caller
to implicitly convert the result to anything other type with some
'IsString' instance.

https://github.com/hasura/graphql-engine-mono/pull/1570

GitOrigin-RevId: fb4294439148ae8b2762138ece2d59e8e18ef5e0
2021-06-18 17:00:24 +00:00
Philip Lykke Carlsen
cfab5fc987 Add support for collapsing nulls across all PG expressions (close #1597)
https://github.com/hasura/graphql-engine-mono/pull/1608

GitOrigin-RevId: 02b6fa0e941a27b3149c9dfb37e0758c94f2986e
2021-06-18 15:34:50 +00:00
Antoine Leblanc
8a77386fcf server: IR for DB-DB joins
### Description

This PR adds the required IR for DB to DB joins, based on @paf31 and @0x777 's `feature/db-to-db` branch.

To do so, it also refactors the IR to introduce a new type parameter, `r`, which is used to recursively constructs the `v` parameter of remote QueryDBs. When collecting remote joins, we replace `r` with `Const Void`, indicating at the type level that there cannot be any leftover remote join.

Furthermore, this PR refactors IR.Select for readability, moves some code from IR.Root to IR.Select to avoid having to deal with circular dependencies, and makes it compile by adding `error` in all new cases in the execution pipeline.

The diff doesn't make it clear, but most of Select.hs is actually unchanged. Declarations have just been reordered by topic, in the following order:
- type declarations
- instance declarations
- type aliases
- constructor functions
- traverse functions

https://github.com/hasura/graphql-engine-mono/pull/1580

Co-authored-by: Phil Freeman <630306+paf31@users.noreply.github.com>
GitOrigin-RevId: bbdcb4119cec8bb3fc32f1294f91b8dea0728721
2021-06-17 23:13:05 +00:00
Phil Freeman
456caa59e1 server: fix caching for queries using remote schema permissions
https://github.com/hasura/graphql-engine-mono/pull/1579

Co-authored-by: Solomon Bothwell <24038+ssbothwell@users.noreply.github.com>
GitOrigin-RevId: 8fdf33863d812f2ee4edee7eec34150a7dc03231
2021-06-17 19:16:59 +00:00
Philip Lykke Carlsen
73e5c6ce47 Generalize set_table_customization to other backends (close #1501)
https://github.com/hasura/graphql-engine-mono/pull/1591

GitOrigin-RevId: 42332798160a3a3b18404345390b235db1dd81a1
2021-06-17 13:22:54 +00:00
Solomon Bothwell
99e7e3b7b4 Implement refresh parameter for Cached Directive
https://github.com/hasura/graphql-engine-mono/pull/1523

Co-authored-by: Phil Freeman <630306+paf31@users.noreply.github.com>
GitOrigin-RevId: f83b73d23db15efdd19a61eca35badc3ff235779
2021-06-17 06:28:45 +00:00
Karthikeyan Chinnakonda
62e7fe62db server: log additional info in the livequery poller logs
https://github.com/hasura/graphql-engine-mono/pull/1529

GitOrigin-RevId: 27060632d5ac0da3f695c6755350f4e32dc0efc1
2021-06-16 13:28:17 +00:00
Tirumarai Selvan
283b77c5e0 tag release v2.0.0-beta.2
GitOrigin-RevId: cb066ee5e6738973f05a442230c074cb262e8c8d
2021-06-16 11:57:34 +00:00
Antoine Leblanc
9a8a211367 server: remove XDistinct, cleanup table arguments
https://github.com/hasura/graphql-engine-mono/pull/1028

GitOrigin-RevId: dae3d46097520f6838b7e95cdda1ab8d53dc9700
2021-06-15 15:54:12 +00:00
Antoine Leblanc
a805f4d185 server: misc cleanups
https://github.com/hasura/graphql-engine-mono/pull/1553

GitOrigin-RevId: b67dc40e54496ed6ad6c85755cf66745664416f7
2021-06-15 15:06:37 +00:00
Chris Done
67a9045328 Bigquery/cleanups
A pull request for cleaning up small issues, bugs, redundancies and missing things in the BigQuery backend.

Summary:

1. Remove duplicate projection fields - BigQuery rejects these.
2. Add order_by to the test suite cases, as it was returning inconsistent results.
3. Add lots of in FromIr about how the dataloader approach is given support.
4. Produce the correct output structure for aggregates:
   a. Should be a singleton object for a top-level aggregate query.
   b. Should have appropriate aggregate{} and nodes{} labels.
   c. **Support for nodes** (via array_agg).
5. Smooth over support of array aggregates by removing the fields used for joining with an explicit projection of each wanted field.

https://github.com/hasura/graphql-engine-mono/pull/1317

Co-authored-by: Vamshi Surabhi <6562944+0x777@users.noreply.github.com>
GitOrigin-RevId: cd3899f4667770a27055f94988ef2a6d5808f1f5
2021-06-15 08:59:11 +00:00
Karthikeyan Chinnakonda
47de5e06cf server: fetch pending events across sources concurrently
https://github.com/hasura/graphql-engine-mono/pull/1562

GitOrigin-RevId: 763e60e8b175ba4b44aefbbf4ebe91455b8e3fff
2021-06-14 16:09:39 +00:00
Antoine Leblanc
5105cba829 server/citus: fix Citus runSQL never rebuilding the schema cache (#1549)
### Description

RunSQL commands are analyzed to detect whether they require a schema cache rebuild; in the case of Citus we were always returning `False`. This PR fixes this, and also removes the catch-all case, to make it explicit / obvious whenever we change this.

https://github.com/hasura/graphql-engine-mono/pull/1549

GitOrigin-RevId: dddaaea868e7b7999bdfe11451032df9d9b44274
2021-06-11 11:38:57 +00:00
Vamshi Surabhi
e8e4f30dd6 server: support remote relationships on SQL Server and BigQuery (#1497)
Remote relationships are now supported on SQL Server and BigQuery. The major change though is the re-architecture of remote join execution logic. Prior to this PR, each backend is responsible for processing the remote relationships that are part of their AST.

This is not ideal as there is nothing specific about a remote join's execution that ties it to a backend. The only backend specific part is whether or not the specification of the remote relationship is valid (i.e, we'll need to validate whether the scalars are compatible).

The approach now changes to this:

1. Before delegating the AST to the backend, we traverse the AST, collect all the remote joins while modifying the AST to add necessary join fields where needed.

1. Once the remote joins are collected from the AST, the database call is made to fetch the response. The necessary data for the remote join(s) is collected from the database's response and one or more remote schema calls are constructed as necessary.

1. The remote schema calls are then executed and the data from the database and from the remote schemas is joined to produce the final response.

### Known issues

1. Ideally the traversal of the IR to collect remote joins should return an AST which does not include remote join fields. This operation can be type safe but isn't taken up as part of the PR.

1. There is a lot of code duplication between `Transport/HTTP.hs` and `Transport/Websocket.hs` which needs to be fixed ASAP. This too hasn't been taken up by this PR.

1. The type which represents the execution plan is only modified to handle our current remote joins and as such it will have to be changed to accommodate general remote joins.

1. Use of lenses would have reduced the boilerplate code to collect remote joins from the base AST.

1. The current remote join logic assumes that the join columns of a remote relationship appear with their names in the database response. This however is incorrect as they could be aliased. This can be taken up by anyone, I've left a comment in the code.

### Notes to the reviewers

I think it is best reviewed commit by commit.

1. The first one is very straight forward.

1. The second one refactors the remote join execution logic but other than moving things around, it doesn't change the user facing functionality.  This moves Postgres specific parts to `Backends/Postgres` module from `Execute`. Some IR related code to `Hasura.RQL.IR` module.  Simplifies various type class function signatures as a backend doesn't have to handle remote joins anymore

1. The third one fixes partial case matches that for some weird reason weren't shown as warnings before this refactor

1. The fourth one generalizes the validation logic of remote relationships and implements `scalarTypeGraphQLName` function on SQL Server and BigQuery which is used by the validation logic. This enables remote relationships on BigQuery and SQL Server.

https://github.com/hasura/graphql-engine-mono/pull/1497

GitOrigin-RevId: 77dd8eed326602b16e9a8496f52f46d22b795598
2021-06-11 03:27:39 +00:00
Antoine Leblanc
2d8ac777b3 server: introduce new custom scalars and remove offsetParser
GitOrigin-RevId: 5db058a7ae8f57bdc7e9844fcdd94e31ce11d961
2021-06-10 16:14:21 +00:00
Vamshi Surabhi
96104ec1a8 Revert "remote schema typename customisation"
This reverts the remote schema type customisation and namespacing feature temporarily as we test for certain conditions.

GitOrigin-RevId: f8ee97233da4597f703970c3998664c03582d8e7
2021-06-10 09:57:16 +00:00
David Overton
4a69fdeb01 Dmoverton/5863 prefix namespacing
GitOrigin-RevId: 108e8b25e745cb4f74d143d316262049cef62b70
2021-06-09 22:42:05 +00:00
Antoine Leblanc
972c662b45 server: cleanup backend types in permissions
GitOrigin-RevId: a5d9f7c25df3d891927d659f6db35b36dc923deb
2021-06-09 19:43:27 +00:00
Antoine Leblanc
8c3808f2bc server: make runMonadSchema backend agnostic
GitOrigin-RevId: ce4e36aedade18d47d035b90a69b9c545ea7d6ed
2021-06-09 13:03:08 +00:00
Rakesh Emmadi
04e041b8cb server: fix replace configuration in add source metadata API
>

### Description
>

### Changelog

- [x] `CHANGELOG.md` is updated with user-facing content relevant to this PR. If no changelog is required, then add the `no-changelog-required` label.

### Affected components

- [x] Server

### Related Issues
->
Fixes #1528

### Solution and Design
>
Only replace connection configuration instead of replacing entire metadata with empty one.

GitOrigin-RevId: f9a16dcc7b1219ec1af915bf083622fcb7dde69a
2021-06-09 12:14:24 +00:00
Sameer Kolhar
b83ba51fa3 server: add logs for version and healthz endpoints
GitOrigin-RevId: 9fdd953173643f88a64f44efc345a3a7da061ec1
2021-06-08 14:28:52 +00:00
Sameer Kolhar
e24abede99 server, multi-tenant: update error logging strategy on pro and multitenant
Co-authored-by: Lyndon Maydwell <92299+sordina@users.noreply.github.com>
GitOrigin-RevId: 7462d36488003bfdacb5566c7a0e9f273a937a0e
2021-06-08 12:56:22 +00:00
Philip Lykke Carlsen
79a80c3f0a MSSQL: Validate variables in subscriptions (close #1210)
GitOrigin-RevId: 5888621dfe44f5f710c2431515114ce0e8864e61
2021-06-08 03:51:15 +00:00
Karthikeyan Chinnakonda
cd509a0036 server: recreate event triggers while migrating source catalog
GitOrigin-RevId: 9a07fec31fcdbe6ef3b96bb61c95e0dd544e7f50
2021-06-07 13:58:16 +00:00
Vamshi Surabhi
355c3ff736 server: split Internal/Parser to avoid hs-boot files
This is a minor refactor (part of `Internal/Parser.hs` is moved into `Internal/Input.hs`) to remove `Collect.hs-boot` and `Directives.hs-boot` files. Without these changes:
1. Most changes would trigger recompilation from the modules with hs-boot files.
1. haskell-language-server fails for some reason in the presence of hs-boot files.

GitOrigin-RevId: 77a2e443417b449c5d7d9d418fc75fcdf076a9ae
2021-06-03 15:15:12 +00:00
Tirumarai Selvan
205a31de0c tag release v2.0.0-beta.1
GitOrigin-RevId: e015b7d72751b54684e2e74a645d0b58714ef102
2021-06-02 12:07:58 +00:00
Chris Done
31658eb874 Implement snakeCaseTableName
This implements the `snakeCaseTableName` method. It's part of the larger BigQuery PR at https://github.com/hasura/graphql-engine-mono/pull/1317, but @0x777 requested a smaller PR with this change.

GitOrigin-RevId: aeb93c3228bb6ba7293cd73b7a34b39c7ed6139a
2021-06-02 11:13:36 +00:00
kodiakhq[bot]
01d8a37706 server: fix asymptotics of event_log batch fetching
Co-authored-by: Rakesh Emmadi <12475069+rakeshkky@users.noreply.github.com>
GitOrigin-RevId: 9b8afb502e94dd371a8596ccde97d023bd2344a9
2021-06-01 17:34:38 +00:00
Philip Lykke Carlsen
fc17132930 Revert splitting-out of variables in MSSQL
GitOrigin-RevId: 720c0e0c775c9418aea569d3f87875236fdcebfe
2021-06-01 10:05:26 +00:00
Karthikeyan Chinnakonda
f1f56ccf75 server: source initialization fix
GitOrigin-RevId: fcb94ca743a99ee3ffe30d40717bb1f0a13cf751
2021-05-31 13:54:59 +00:00
Philip Lykke Carlsen
125f37ea28 Server: Use a bespoke type for nullability instead of Bool
GitOrigin-RevId: a793c7a921174611d44b7e7cdc1dc43b132376fe
2021-05-28 10:40:15 +00:00
Swann Moreau
b825af9a96 server: fix error propagation in initCatalogForSource
GitOrigin-RevId: 679bca324dfa7728ebcff5862782f29f538bee20
2021-05-28 08:57:46 +00:00
Lyndon Maydwell
f3749f24b3 Fix for 6913 - Undefined ENV variable during a replace metadata throws on allow_inconsistent_metadata
GitOrigin-RevId: 46494f8784d21179e49d2034e1f68171cf146e49
2021-05-28 04:32:33 +00:00
Antoine Leblanc
30ef72bc93 server: better error message on column type mismatch
GitOrigin-RevId: d3d1ff4278e4ced37e90e950fd9043883f72d37f
2021-05-27 16:47:01 +00:00
Rakesh Emmadi
e43d0273e0 server: mssql: apply schema changes by mssql_run_sql DDL on metadata (fix #779)
Co-authored-by: Antoine Leblanc <1618949+nicuveo@users.noreply.github.com>
GitOrigin-RevId: 6905d5914c8a698445c0ef03d6a8303747701e1c
2021-05-27 15:07:10 +00:00
Antoine Leblanc
00ca310d21 server: do not do a "successful" noop when tracking a function in the wrong source
GitOrigin-RevId: 9eb78899acd0c60081b2a999a75c11b32f394ba7
2021-05-27 12:09:19 +00:00
Karthikeyan Chinnakonda
7d630e8147 build: use the debian buster version in the docker image
GitOrigin-RevId: 51077f8b5d0c5bdf06a6560444f89d74a3660336
2021-05-27 07:50:15 +00:00
Swann Moreau
390a1552a8 server: rename inDevelopmentMode -> devMode
GitOrigin-RevId: a99deb144f07f4b0bdf60430a12ad34962355d36
2021-05-27 06:52:14 +00:00
Karthikeyan Chinnakonda
72c24eea69 server: fix cron trigger bug of new events not getting generated when cron trigger is imported via metadata
Co-authored-by: Rakesh Emmadi <12475069+rakeshkky@users.noreply.github.com>
GitOrigin-RevId: 1a9076e039ba2c8da898683c64ef988fb8512eae
2021-05-26 16:20:19 +00:00
Abby Sassel
06bfe650f0 server/mssql: subscription test cleanup post-fix
GitOrigin-RevId: b67e577b15be3c54f869bb3497b30fb0bb53ddf0
2021-05-26 09:06:57 +00:00
Swann Moreau
8e3e7501c7 server: do not collect metrics for sources that have been dropped
GitOrigin-RevId: ed439426527237c2907df77f45582dbe566aeb51
2021-05-26 07:41:28 +00:00
Antoine Leblanc
1674325eb2 server/mssql: fix order of clause in reselect query generation
GitOrigin-RevId: fb7a258059b767a275a5b337e1549f6b3be45499
2021-05-25 14:58:51 +00:00
Tirumarai Selvan
54b9e96702 update contributing.md with server dependencies
GitOrigin-RevId: 9c42625eea8d758e8aff3eca0af8cde48a500766
2021-05-25 14:00:33 +00:00
Abby Sassel
41908936cf server: improve backend-specific test setup
GitOrigin-RevId: c40393bcdd78feaba7e9490ce4ed78de19b5bfc5
2021-05-25 13:55:11 +00:00
Tirumarai Selvan
3bcf758e14 tag release v2.0.0-alpha.11
GitOrigin-RevId: cbc36c7b0385ad7e1ca7fcda8a364ee9b201b35d
2021-05-25 12:18:44 +00:00
Vladimir Ciobanu
5ad01a4bac server: Add test file to suite
GitOrigin-RevId: 6522f776c9b267d5c94be484d55f879e79d30c96
2021-05-25 11:37:14 +00:00
Naveen Naidu
12b57530f3 server: log warning for deprecated environment variables
Co-authored-by: Anon Ray <616387+ecthiender@users.noreply.github.com>
GitOrigin-RevId: e3a845d93d05545816aa9448aad5845b7247b679
2021-05-25 10:50:51 +00:00
Swann Moreau
d3611af58d server: lazy event catalog initialisation
event catalog:
- `hdb_catalog` is no longer automatically created
- catalog is initialised when the first event trigger is created
- catalog initialisation is done during the schema cache build, using `ArrowCache` so it is only run in response to a change to the set of event triggers

event queue:
- `processEventQueue` thread is prevented from starting when `HASURA_GRAPHQL_EVENTS_FETCH_INTERVAL=0`
- `processEventQueue` thread only processes sources for which at least one event trigger exists in some table in the source

Co-authored-by: Anon Ray <616387+ecthiender@users.noreply.github.com>
GitOrigin-RevId: 73f256465d62490cd2b59dcd074718679993d4fe
2021-05-25 06:51:03 +00:00
Antoine Leblanc
6e95f761f5 server: rewrite remote input parsers to deal with partial variable expansion (fix hasura/graphql-engine#6656)
GitOrigin-RevId: e0b197a0fd1e259d43e6152b726b350c4d527a4b
2021-05-24 20:13:47 +00:00
Anon Ray
53beef47ea server, console, docs: fix untrack_function metadata query bug
Co-authored-by: Sameer Kolhar <6604943+kolharsam@users.noreply.github.com>
GitOrigin-RevId: a68a6f8b5c5243372332bfec7d9cdcd3011c001f
2021-05-24 15:57:26 +00:00
Vladimir Ciobanu
0f8f4764c7 server: rename source
GitOrigin-RevId: 5f4a17941bfd447deb9663a4c250f149238c5f53
2021-05-24 13:15:02 +00:00
Abby Sassel
c9e7e10eaa server/bugfix: Include permission filter in the exists clause. Fixes #6931
GitOrigin-RevId: d3080dfa00c96afcf1254d83757a5e50a0726381
2021-05-24 09:09:50 +00:00
Anon Ray
63594e1828 server: fix referenced session vars for live queries when UDF has specified session argument
GitOrigin-RevId: 23efdf4d3b3902b5ce7ec14061faa53b18258e86
2021-05-24 07:34:33 +00:00
Chris Done
feb08d8998 Various MSSQL bugfixes/cleanups
GitOrigin-RevId: 673df70de7b7f9130482b7a28f860bbaffad44a4
2021-05-21 12:28:52 +00:00
Philip Lykke Carlsen
8cc358b023 Plc/feature/mssql logging variables
GitOrigin-RevId: b67a09cbc5bb8b21857c25a0827800ca1826fa1c
2021-05-21 11:38:23 +00:00
Antoine Leblanc
60a119ae22 server: also collect types from directives into the schema
GitOrigin-RevId: 0736570fd8781e66d558bde313d26ad62f7cf6ca
2021-05-21 04:55:32 +00:00
Abby Sassel
1afa4ac3cc server/citus: feature branch
Co-authored-by: Vladimir Ciobanu <1017953+vladciobanu@users.noreply.github.com>
Co-authored-by: Antoine Leblanc <1618949+nicuveo@users.noreply.github.com>
Co-authored-by: Ikechukwu Eze <22247592+iykekings@users.noreply.github.com>
Co-authored-by: Philip Lykke Carlsen <358550+plcplc@users.noreply.github.com>
Co-authored-by: Phil Freeman <630306+paf31@users.noreply.github.com>
GitOrigin-RevId: 1b964fe5f5f50380172cb702b6a328fed782b6b7
2021-05-21 02:47:51 +00:00
Solomon Bothwell
6d2d2a5826 Postgres Client Cert Update
Co-authored-by: Lyndon Maydwell <92299+sordina@users.noreply.github.com>
GitOrigin-RevId: 50fe785fbc0156fc7df3ad3c71c8aca7c0256318
2021-05-21 01:50:43 +00:00
Naveen Naidu
44f6f06e89 server: Add tests for the event trigger big int and geojson format payload bug fix
GitOrigin-RevId: 1e796b16dca54849334381e855b17b19609c8b7a
2021-05-20 12:27:35 +00:00
Antoine Leblanc
5238bb8011 server: support for custom directives
Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com>
GitOrigin-RevId: f11b3b2e964af4860c3bb0fd9efec6be54c2e88b
2021-05-20 10:03:50 +00:00
Naveen Naidu
d8d4626ba3 server: fix bigint overflow, incorrect geojson format in event trigger payload
GitOrigin-RevId: f43f54f6851d366b60ff72a1fe9b89ca236c3d89
2021-05-20 07:24:20 +00:00
Karthikeyan Chinnakonda
9a99923fef server: support adding a tracked function as a computed field and vice versa
GitOrigin-RevId: 2f4db0b716d493ce245d9fa7e37e11382f18cd67
2021-05-20 06:29:24 +00:00
Antoine Leblanc
03c70c7b7d tests: skip test_pg_multisource_table_name_conflict if the setup isn't correct
GitOrigin-RevId: 4e658812eaac6534e6b6606f03e893449ad4b975
2021-05-19 21:06:54 +00:00
Antoine Leblanc
dfbdfca144 server: fix order of fields in introspection output
GitOrigin-RevId: edd6af755d46c3d13c8b7b5504f8d89701a3250f
2021-05-19 16:38:54 +00:00
Swann Moreau
a83194239e server: forward request id when not user-provided
GitOrigin-RevId: 78745dda0112321c809220fdcdeaf2adc6f9c3e5
2021-05-19 14:08:00 +00:00
Abby Sassel
3ba5d1e540 server: include more detail in inconsistent metadata error messages (fix #6684)
GitOrigin-RevId: 1a0d8fa2b465320e9ab4ea43259d0e8d92364473
2021-05-19 05:02:53 +00:00
David Overton
ddad668f07 Fix/custom table name
GitOrigin-RevId: 5004717ac7d9e848ca186a1cdf52e375547034bf
2021-05-18 13:37:27 +00:00
Antoine Leblanc
ecb90c47a1 server: fix action output fields return type (fix hasura/graphql-engine#6631)
GitOrigin-RevId: 9be5ac87fe69c55aafb6b5af918eb4deb97e27d5
2021-05-18 09:32:43 +00:00
Naveen Naidu
14f80c55ff EventTrigger: Fix num_event_fetched EKG metric
GitOrigin-RevId: 6ca047edb235f1b30986c08698410ce71f587849
2021-05-17 09:50:29 +00:00
Antoine Leblanc
4fce62d125 server: fix action poller being a bit too eager
GitOrigin-RevId: a767123e49aeb3ee472e9313a86b55a30db468e4
2021-05-17 06:00:02 +00:00