Commit Graph

619 Commits

Author SHA1 Message Date
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
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
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
Daniel Harvey
42817af958 chore(server): split NamingCase type from functions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9184
GitOrigin-RevId: caf36bdaa6c739855153b33a0f130b3f2dda6c0a
2023-05-17 14:03:40 +00:00
Daniel Harvey
8f4692d871 chore(server): move table related things to Hasura.Table.*
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9174
GitOrigin-RevId: d440647ac04b9c1717ecf22a2dbfb8c5f22b7c7a
2023-05-17 08:55:32 +00:00
Tom Harding
56a015fdfd Introduce Backend::getTableInfo
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9172
GitOrigin-RevId: 4c90f250d0172fd911eadbe5bbd6949770139cd0
2023-05-16 16:29:38 +00:00
Daniel Harvey
0da011f272 chore(server): move Lenses into RQL.IR.Select.Lenses
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9096
GitOrigin-RevId: 09d69af150f66309b523133c70364f96de40d9cb
2023-05-09 16:22:53 +00:00
Daniel Harvey
285a200a87 chore(server): delete MySQL native backend
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9050
GitOrigin-RevId: 1515fb0efdb1baa05ffe3ff7cf6f230acd0cde29
2023-05-05 10:32:56 +00:00
Gil Mizrahi
56e3bd182a chore(refactor): extract common functionality between stored procedures and native queries
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9028
GitOrigin-RevId: ab5c1ca9c08600a758f07aa81370930c305d6b40
2023-05-03 10:00:56 +00:00
Gil Mizrahi
f6fd9f071d refactor(cleanup): extract interpolated query
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9002
GitOrigin-RevId: 2e2a499f5035adf1493a2d675ee52abb7c87a8c8
2023-04-28 19:25:32 +00:00
Daniel Harvey
6178a1fd82 chore(server): split Logical Model lenses into files
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8989
GitOrigin-RevId: f0f6e75732408f21ebe5fdc5af3f680cd96ae789
2023-04-28 18:47:38 +00:00
Gil Mizrahi
7aef17863a refactor(cleanup): extract nullablescalartype
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9001
GitOrigin-RevId: 5053e4c881f0d037b9170b434bcf533284a827a6
2023-04-28 16:16:08 +00:00
Daniel Harvey
5b2465f22a chore(server): move template haskell out of more Hasura.RQL folders
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8994
GitOrigin-RevId: a7aec36c87fe6a53d704c7a7fb6d625853914dda
2023-04-28 15:41:56 +00:00
Daniel Harvey
2e9b0ad3f2 chore(server): remove TH aeson, separate lenses, in Hasura.RQL.DDL
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8993
GitOrigin-RevId: dda6b7b915236c4f013b28ce98aa34c48e9a53db
2023-04-28 15:13:32 +00:00
Daniel Harvey
9a0c761b4a chore(server): remove Template Haskell from Hasura.Function
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8992
GitOrigin-RevId: a06cf33a96d6ef8ad2234a385016b5e68c46b8f2
2023-04-28 14:14:26 +00:00
Tom Harding
a1512b1bde Remove RQL.Types -> RQL.DDL dependencies
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8913
GitOrigin-RevId: 32b62ff7c1083161c96af98c3a4ec1a2e01af9ab
2023-04-28 10:48:15 +00:00
Daniel Harvey
800b6aa9be chore(server): copy pasta Stored Procedures
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8969
GitOrigin-RevId: 2a33ab836fc26619acbe160278c87d036253388d
2023-04-27 14:04:28 +00:00
Tom Harding
74f282ad16 chore(server): remove Eventing instances from RQL.Types
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8909
GitOrigin-RevId: 302a9583c3364d507dfe106111ffcabac0b1dbf5
2023-04-25 17:18:30 +00:00
Tom Harding
2a9575f922 Split Hasura.Session, remove RQL.Types dependency
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8921
GitOrigin-RevId: b3586942838be4d7a7d48b6b50c7e2643cd8fa06
2023-04-25 15:57:08 +00:00
Tom Harding
6a53470728 Break Metadata.DTO.Utils into Autodocodec.Extended and RQL.Types.BackendTag
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8874
GitOrigin-RevId: 77a8f61e1f5a5bb84908b5afd743a575e723d87f
2023-04-25 09:01:12 +00:00
Tom Harding
1a23e47818 Separate Hasura.EncJSON into its own package
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8875
GitOrigin-RevId: 9622bb67b6c357837db3e3a9f26e8e471ec7382c
2023-04-25 08:25:06 +00:00
Daniel Harvey
ea5c92acae chore(server): move Hasura.SQL.Backend to Hasura.RQL.Types.BackendType
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8876
GitOrigin-RevId: abfc18eeef96a1f3593bfe823adab4d161161333
2023-04-24 18:37:33 +00:00
Tom Harding
de8e6c022d Move the GHC directory into hasura-extras
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8888
GitOrigin-RevId: 50cdb72293096faa2c6ab94fe40bbc59d232d4e1
2023-04-24 17:25:32 +00:00
Daniel Harvey
8cf134dad1 Split Hasura.RQL.DDL.Headers to put types in Hasura.RQL.Types.Headers
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8873
GitOrigin-RevId: 566cb4271f0eb27e6688c2e0fbc26711bdf8baa9
2023-04-24 16:45:55 +00:00
Tom Harding
f8ae944dbc Move Hasura.GraphQL.Schema.Options to Hasura.RQL.Types.Options
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8877
GitOrigin-RevId: 8be82f60a57cd9582d6980a6dea2f34c7b0c13c1
2023-04-24 15:18:56 +00:00
Tom Harding
982bf2cec6 RemoveHasura.RQL.Types dependency on Backends.Postgres.Execute.Types
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8869
Co-authored-by: Daniel Harvey <4729125+danieljharvey@users.noreply.github.com>
GitOrigin-RevId: acabf17b5b9bde9f0f319eeae120ccc9527075a3
2023-04-24 14:41:19 +00:00
Tom Harding
f80369573c Move Hasura.SQL.Tag into RQL.Types
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8871
Co-authored-by: Daniel Harvey <4729125+danieljharvey@users.noreply.github.com>
GitOrigin-RevId: f69ff31018d6a68a3221d75cc1e2ef467bc46e12
2023-04-24 12:27:27 +00:00
Tom Harding
eac27bbf13 Extract Network and Net into hasura-extras
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8855
Co-authored-by: Daniel Harvey <4729125+danieljharvey@users.noreply.github.com>
GitOrigin-RevId: 5bde8ff821739c37a2e4435b57a5a623bc66de42
2023-04-24 11:13:34 +00:00
Tom Harding
8292a9fae3 Move both Autodocodec.Extended modules into hasura-extras
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8851
Co-authored-by: Daniel Harvey <4729125+danieljharvey@users.noreply.github.com>
GitOrigin-RevId: 1095c52338d15ec41f1a09f2c40da74f038c8102
2023-04-21 15:25:12 +00:00
Tom Harding
99c1d99ecb chore(server): break out Hasura.Base into own package
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8850
Co-authored-by: Daniel Harvey <4729125+danieljharvey@users.noreply.github.com>
GitOrigin-RevId: 47310479d66adc3baf27ca9d2dbda7addea6bb3d
2023-04-21 14:26:15 +00:00
Tom Harding
3151dd0074 Extract hasura-extras from graphql-engine
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8848
Co-authored-by: Daniel Harvey <4729125+danieljharvey@users.noreply.github.com>
GitOrigin-RevId: 4a667e2760f866e57e0e7d804815153571b413e6
2023-04-21 13:15:27 +00:00
Philip Lykke Carlsen
983fc2ad47 Rename "Custom Return Types" → "Logical Models"
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8800
GitOrigin-RevId: e5e10f31c6cc8953a8ee947441a7f80b0e9b5e5e
2023-04-19 09:05:25 +00:00
Daniel Harvey
69e329ee18 chore(server): break down Hasura.RQL.IR.Select somewhat
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8779
GitOrigin-RevId: 9e40de0ed36cfe84d1457bd7c6a96c80e31d357b
2023-04-17 15:21:05 +00:00
Daniel Harvey
eab64a8ca3 chore(server): replace Metadata.hs-boot with 3 orphan instances
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8740
GitOrigin-RevId: 801f03045b9981b07f8c0abfdeb2722e715e63cd
2023-04-17 12:11:21 +00:00
Philip Lykke Carlsen
0346224444 Rename "Logical Models" → "Native Queries"
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8769
GitOrigin-RevId: 66f2cbfb620d641e672a4074554d9d324a18c591
2023-04-13 16:12:20 +00:00
Tom Harding
3cef692dd7 feature(server): Get _all_ source tables
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8649
GitOrigin-RevId: 4bb9311d1d7ab4e8ee641bde5df2babcb1b8b306
2023-04-05 20:16:14 +00:00
Rishichandra Wawhal
c6d65508b2 [feature branch] EE Lite Trials
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8208
Co-authored-by: awjchen <13142944+awjchen@users.noreply.github.com>
Co-authored-by: Vijay Prasanna <11921040+vijayprasanna13@users.noreply.github.com>
Co-authored-by: Toan Nguyen  <1615675+hgiasac@users.noreply.github.com>
Co-authored-by: Abhijeet Khangarot <26903230+abhi40308@users.noreply.github.com>
Co-authored-by: Solomon <24038+solomon-b@users.noreply.github.com>
Co-authored-by: gneeri <10553562+gneeri@users.noreply.github.com>
GitOrigin-RevId: 454ee0dea636da77e43810edb2f427137027956c
2023-04-05 08:59:09 +00:00
Daniel Chambers
fde4c0fae5 Enhance insert table schema with extra info and remove need for cached schema usage in Super Connector mutations
[GDC-643]: https://hasurahq.atlassian.net/browse/GDC-643?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8560
GitOrigin-RevId: 0e965da447eb6a5acf5a0f291f9e205882630e6e
2023-04-05 02:23:20 +00:00
Antoine Leblanc
306162f477 Remove ServerConfigCtx.
### Description

This PR removes `ServerConfigCtx` and `HasServerConfigCtx`. Instead, it favours different approaches:
- when the code was only using one field, it passes that field explicitly (usually `SQLGenCtx` or `CheckFeatureFlag`)
- when the code was using several fields, but in only one function, it inlines
- for the cache build, it introduces `CacheStaticConfig` and `CacheDynamicConfig`, which are subsets of `AppEnv` and `AppContext` respectively

The main goal of this is to help with the modularization of the engine: as `ServerConfigCtx` had fields whose types were imported from several unrelated parts of the engine, using it tied together parts of the engine that should not be aware of one another (such as tying together `Hasura.LogicalModel` and `Hasura.GraphQL.Schema`).

The bulk of this PR is a change to the cache build, as a follow up to #8509: instead of giving the entire `ServerConfigCtx` as a incremental rule argument, we only give the new `CacheDynamicConfig` struct, which has fewer fields. The other required fields, that were coming from the `AppEnv`, are now given via the `HasCacheStaticConfig` constraint, which is a "subset" of `HasAppEnv`.

(Some further work could include moving `StringifyNumbers` out of `GraphQL.Schema.Options`, given how it is used all across the codebase, including in `RQL.DML`.)

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8513
GitOrigin-RevId: 818cbcd71494e3cd946b06adbb02ca328a8a298e
2023-04-04 16:01:42 +00:00
Auke Booij
7cc33dd8ec server: refactor Hasura.Metadata.Class
- Remove `MonadMetadataStorageQueryAPI` which was only implemented by a default implementation
- Introduce `TransT` which can be used to easily derive `lift`ing implementations for `MonadBlaBlaBla` classes

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8579
GitOrigin-RevId: 4f804fda7e2de5c9d75ee4df269f500ebd46b8c9
2023-04-03 13:36:50 +00:00
Daniel Harvey
cb9f822fc0 chore(server): move user-defined-functions into Hasura.Function.*
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8595
GitOrigin-RevId: b3b7dec8504fe4daf324125e4017fa7d1945b3ca
2023-04-03 10:20:20 +00:00
Daniel Harvey
79682e0598 chore(server): move custom types out of logical models
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8565
Co-authored-by: Tom Harding <6302310+i-am-tom@users.noreply.github.com>
GitOrigin-RevId: 38bf56cc420a6c818a9ca7d6f846f5018535c808
2023-03-31 15:35:13 +00:00
Auke Booij
79b8a6a07b chore(server): move some query tags code to a sensible place
Also add a `default` implementation for `MonadQueryTags`.

This avoids a bunch of imports on `Hasura.GraphQL.Execute.Backend` which is a big module with lots of (transitive) dependencies.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8571
GitOrigin-RevId: 8ecca452721b77953e6d088c79d8d6f003f2996f
2023-03-30 21:19:38 +00:00
Jesse Hallett
bd9f93eaef server: codecs for backend configs
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8269
GitOrigin-RevId: 34330f383ca82fb159842a171a763c178b462788
2023-03-30 15:53:55 +00:00
Daniel Harvey
7227e96278 feature(server): custom return types as discreet metadata entity
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8556
Co-authored-by: Tom Harding <6302310+i-am-tom@users.noreply.github.com>
GitOrigin-RevId: b7dcbcf378279c3bf4c8d223174b90c2cb4b9e53
2023-03-30 15:15:11 +00:00
paritosh-08
677a972956 server: improve connection template error message
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8517
GitOrigin-RevId: 3240e569322f3c9bf9376bbf4ea01c5d48218f07
2023-03-29 13:37:33 +00:00
Antoine Leblanc
0a1628c0cc Clean AppEnv and AppContext passing, remove RunT, reduce ServerConfigCtx uses
## Description

This PR does several different things that happen to overlap; the most important being:
- it removes `RunT`: it was redundant in places where we already had `Handler`, and only used in one other place, `SchemaUpdate`, for which a local `SchemaUpdateT` is more than enough;
- it reduces the number of places where we create a `ServerConfigCtx`, since now `HasServerConfigCtx` can be implemented directly by `SchemaUpdateT` and `Handler` based on the full `AppContext`;
- it drastically reduces the number of arguments we pass around in the app init code, by introducing `HasAppEnv`;
- it simplifies `HandlerCtx` to reduce duplication

In doing so, this changes paves the way towards removing `ServerConfigCtx`, since there are only very few places where we construct it: we can now introduce smaller classes than `HasServerConfigCtx`, that expose only a relevant subset of fields, and implement them where we now implement `HasServerConfigCtx`.

This PR is loosely based on ideas in #8337, that are no longer applicable due to the changes introduced in #8159. A challenge of this PR was the postgres tests, which were running in `PGMetadataStorageAppT CacheBuild` 🙀

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8392
GitOrigin-RevId: b90c1359066d20dbea329c87762ccdd1217b4d69
2023-03-21 10:45:56 +00:00
Puru Gupta
c437a42f6d server: rename SchemaCacheRef to AppStateRef and add AppContext to it
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8159
Co-authored-by: Naveen Naidu <30195193+Naveenaidu@users.noreply.github.com>
Co-authored-by: Anon Ray <616387+ecthiender@users.noreply.github.com>
GitOrigin-RevId: a57f6dc8b3e992d86490e5c51508827f00151dfe
2023-03-17 10:30:38 +00:00
Daniel Harvey
95f5553af6 chore(server): split new statistics log from QueryLog
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8326
GitOrigin-RevId: 02ee652302de5328e63054a6448dca10de7b5c1b
2023-03-15 13:06:47 +00:00
Antoine Leblanc
cf531b05cb Rewrite Tracing to allow for only one TraceT in the entire stack.
This PR is on top of #7789.

### Description

This PR entirely rewrites the API of the Tracing library, to make `interpTraceT` a thing of the past. Before this change, we ran traces by sticking a `TraceT` on top of whatever we were doing. This had several major drawbacks:
- we were carrying a bunch of `TraceT` across the codebase, and the entire codebase had to know about it
- we needed to carry a second class constraint around (`HasReporterM`) to be able to run all of those traces
- we kept having to do stack rewriting with `interpTraceT`, which went from inconvenient to horrible
- we had to declare several behavioral instances on `TraceT m`

This PR rewrite all of `Tracing` using a more conventional model: there is ONE `TraceT` at the bottom of the stack, and there is an associated class constraint `MonadTrace`: any part of the code that happens to satisfy `MonadTrace` is able to create new traces. We NEVER have to do stack rewriting, `interpTraceT` is gone, and `TraceT` and `Reporter` become  implementation details that 99% of the code is blissfully unaware of: code that needs to do tracing only needs to declare that the monad in which it operates implements `MonadTrace`.

In doing so, this PR revealed **several bugs in the codebase**: places where we were expecting to trace something, but due to the default instance of `HasReporterM IO` we would actually not do anything. This PR also splits the code of `Tracing` in more byte-sized modules, with the goal of potentially moving to `server/lib` down the line.

### Remaining work

This PR is a draft; what's left to do is:
- [x] make Pro compile; i haven't updated `HasuraPro/Main` yet
- [x] document Tracing by writing a note that explains how to use the library, and the meaning of "reporter", "trace" and "span", as well as the pitfalls
- [x] discuss some of the trade-offs in the implementation, which is why i'm opening this PR already despite it not fully building yet
- [x] it depends on #7789 being merged first

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7791
GitOrigin-RevId: cadd32d039134c93ddbf364599a2f4dd988adea8
2023-03-13 17:38:39 +00:00