Commit Graph

2796 Commits

Author SHA1 Message Date
Abby Sassel
89d838b85a server: split BoolExpBasic tests into common and backend-specific classes
GitOrigin-RevId: 9e62260881de63e5f89007bb1d6607254625cda7
2021-03-17 10:57:06 +00:00
Vladimir Ciobanu
91710bba58 server: use relative paths in TH splices
While debugging issues with HLS, Reed Mullanix noticed that we don't use relative paths. This leads to problems when using HLS + Emacs due to a bug in `lsp-mode` which prevents it from finding the correct project root.

However, it is still a good practice to use relative paths in TH for other reasons, including being able to import these modules in GHCI.

This PR should make it so HLS-1.0 & emacs provide type inference, imports, etc., in all modules in our codebase.

GitOrigin-RevId: 5f53b9a7ccf46df1ea7be94ff0a5c6ec861f4ead
2021-03-16 17:36:39 +00:00
Abby Sassel
881cc55e0e server: split TestGraphQLQueryBasic into common and backend-specific test classes
GitOrigin-RevId: 9e99047f7ab83f06c94c4741c7c0591eb2ca35e8
2021-03-16 16:42:20 +00:00
Naveen Naidu
babb05451a multitenant: change default connection pool params
GitOrigin-RevId: 44d005c2d8e941d955f4654f21da091e5c1520ae
2021-03-16 15:29:43 +00:00
Karthikeyan Chinnakonda
d1a2fabb26 server: fix the FromJSON instance of ExperimentalFeature
GitOrigin-RevId: 4d3c296021bfc26295632fb4b331c1fe0c902734
2021-03-16 11:49:00 +00:00
Solomon Bothwell
e4b669e56b Traverses RFAction RootField cnstr to accumulate session variables
GitOrigin-RevId: 148bc50c59820254dc40b8951e43abadcac2c25b
2021-03-16 06:13:31 +00:00
Kali Vara Purushotham Santhati
c3e60aba28 cli: update cli help texts and docs generation
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com>
GitOrigin-RevId: b6909583093baac4a69296721feae149ca6a0605
2021-03-15 15:41:54 +00:00
Vladimir Ciobanu
da8f6981d4 server: reduce the number of backend dispatches
Fixes https://github.com/hasura/graphql-engine-mono/issues/712

Main point of interest: the `Hasura.SQL.Backend` module.

This PR creates an `Exists` type indexed by indexed type and packed constraint while hiding all of its complexity by not exporting the constructor.

Existential constructors/types which are no longer (directly) existential:
- [X] BackendSourceInfo :: BackendSourceInfo
- [x] BackendSourceMetadata :: BackendSourceMetadata
- [x] MOSourceObjId :: MetadatObjId
- [x] SOSourceObj :: SchemaObjId
- [x] RFDB :: RootField
- [x] LQP :: LiveQueryPlan
- [x] ExecutionStep :: ExecStepDB

This PR also removes ALL usages of `Typeable.cast` from our codebase. We still need to derive `Typeable` in a few places in order to be able to derive `Data` in one place. I have not dug deeper to see why this is needed.

GitOrigin-RevId: bb47e957192e4bb0af4c4116aee7bb92f7983445
2021-03-15 13:03:55 +00:00
Praveen Durairaju
7fe46423b8 remove migrations webinar in docs, fix conflict in sample apps
GitOrigin-RevId: d2969c7376b51723ae7c52d0666309f75aad98d1
2021-03-15 08:34:49 +00:00
Shraddha Agrawal
0b81677fc6 docs/cloud: change metric name
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
GitOrigin-RevId: ea55c9661ccdcc7d454bd8508e0bf6c58a259145
2021-03-15 07:49:52 +00:00
Karthikeyan Chinnakonda
6093010a6e server: fix issue of parsing input objects in remote schema queries
GitOrigin-RevId: 98c62cab836aff2778dbfedd6535450989090a30
2021-03-15 06:32:07 +00:00
Antoine Leblanc
a544fe9822 server: generalized LogQueryLog (fix #708)
GitOrigin-RevId: 0e18e0f5caaa6889804debf7111ef9aa99e080b5
2021-03-13 14:41:44 +00:00
kodiakhq[bot]
c8934d0b57 circleci: Use backport of Matt Pickering's memory reclamation RTS patch in CI
A few cleanups in CI, and use Matt's patch for better idle memory reclamation.

See Swann's report here: https://docs.google.com/document/d/1K1ofxYCIDdO75_UOAqJHn3CeMNE78MrJIJR-GG9iEKg/edit
And patch here: 29d4df0f5e

GitOrigin-RevId: ecdd4cbdd4244a8abf022078525c1843bf2a4aea
2021-03-12 02:09:21 +00:00
Sooraj
ec79fcf52a console: connect database enhancements and misc fixes
Co-authored-by: Aleksandra Sikora <9019397+beerose@users.noreply.github.com>
GitOrigin-RevId: a44482a1f88ad94c462b72162cbfbb35397640a3
2021-03-11 19:42:14 +00:00
Abby Sassel
64d52f5fa3 server: generalize integration tests
Co-authored-by: Antoine Leblanc <1618949+nicuveo@users.noreply.github.com>
GitOrigin-RevId: 647edb8d293bf783c504b7e15ce02c56858b3b72
2021-03-11 18:18:41 +00:00
Karthikeyan Chinnakonda
067a38f74d docs: document inherited roles
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
GitOrigin-RevId: b147ed69b90c40d6e1478f028f5d9d7e6f5629f0
2021-03-11 15:21:50 +00:00
Aleksandra Sikora
5778fe3e9b console: support mssql views in console
GitOrigin-RevId: 52474d57f233e0d79911ae0c1d98b5c595d5d7e4
2021-03-11 10:15:48 +00:00
Aravind K P
c35e4a26b6 docs: refactor cli docs to match latest changes
GitOrigin-RevId: 4adbc5fbbd60a6e7749f36f3d112c09ba9c4a60a
2021-03-11 08:13:28 +00:00
hasura-bot
0c1133b393 console: update select font for firefox
This PR was migrated from https://github.com/hasura/graphql-engine/pull/5923

---
### 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.

Co-authored-by: Kim <20434382+kimberrypi@users.noreply.github.com>
Co-authored-by: Aleksandra Sikora <9019397+beerose@users.noreply.github.com>
GitOrigin-RevId: 244c5272ef1113af840f9b5379826ff60e7f1136
2021-03-10 23:03:06 +00:00
Abby Sassel
660b442943 server: misc. dev.sh improvements
Co-authored-by: Antoine Leblanc <1618949+nicuveo@users.noreply.github.com>
GitOrigin-RevId: 4c93b49a370afb98747aabc1c977494297432402
2021-03-10 22:19:14 +00:00
Rikin Kachhia
3696d92743 add github workflow to compress new images in PRs
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
GitOrigin-RevId: cfef3585b120d82cafe5343cfceddbcd05969a15
2021-03-10 20:55:02 +00:00
hasura-bot
43de7cdf17 console: add loading spinner for graphiql to indicate that introspection is in progress
GITHUB_PR_NUMBER: 5873
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/5873

Co-authored-by: Varun Choudhary <68095256+Varun-Choudhary@users.noreply.github.com>
GitOrigin-RevId: efb51dd44a99e82769f4e384c76a08088195c20d
2021-03-10 20:09:55 +00:00
hasura-bot
bf8a22083e console: reset permission editor after creating new role
GITHUB_PR_NUMBER: 5833
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/5833

Co-authored-by: Varun Choudhary <68095256+Varun-Choudhary@users.noreply.github.com>
GitOrigin-RevId: 8504c95c5d8fcae41a00b2afb391b99fa594b1e0
2021-03-10 19:20:21 +00:00
Karthikeyan Chinnakonda
84d55cf771 docs: add a guide on writing python tests
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
GitOrigin-RevId: 37528597f947a62b4c119cad8feb5428b904a00b
2021-03-10 17:30:41 +00:00
Aishwarya Rao
9b02f1572e docs: Update docs for cloud dashboard
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
GitOrigin-RevId: dc8c870d802f2b3d6bce19d2b468ffad1c764e95
2021-03-10 14:54:28 +00:00
Tirumarai Selvan
692e374c94 tag release v2.0.0-alpha.4
GitOrigin-RevId: fdde115ba4442795494566f2d6a2aacbf50f0632
2021-03-10 11:48:44 +00:00
Vijay Prasanna
89e26d3e9f console: add inherited roles tab
Co-authored-by: Abhijeet Singh Khangarot <26903230+abhi40308@users.noreply.github.com>
Co-authored-by: Aleksandra Sikora <9019397+beerose@users.noreply.github.com>
GitOrigin-RevId: b6edc26b96e2cd0db11e7951b7941a631932d125
2021-03-10 10:45:18 +00:00
Anon Ray
d16bc4fe46 server: fix handling of nullable object relationships
GitOrigin-RevId: 3214e77ed06a07b6c1293d59daa088649a881e78
2021-03-10 08:56:03 +00:00
Rakesh Emmadi
2b0c990d50 server: remove Action.hs-boot file
GitOrigin-RevId: 65267a7b6343a12b690f7710785fdfa30873e479
2021-03-10 07:27:19 +00:00
Lyndon Maydwell
0c1016e065 Inconsistent metadata support for REST endpoints
Previously invalid REST endpoints would throw errors during schema cache build.

This PR changes the validation to instead add to the inconsistent metadata objects in order to allow use of `allow_inconsistent_metadata` with inconsistent REST endpoints.

All non-fatal endpoint definition errors are returned as inconsistent metadata warnings/errors depending on the use of `allow_inconsistent_metadata`. The endpoints with issues are then created and return informational runtime errors when they are called.

Console impact when creating endpoints is that error messages now refer to metadata inconsistencies rather than REST feature at the top level:

![image](https://user-images.githubusercontent.com/92299/109911843-ede9ec00-7cfe-11eb-9c55-7cf924d662a6.png)

<img width="969" alt="image" src="https://user-images.githubusercontent.com/92299/110258597-8336fa00-7ff7-11eb-872c-bfca945aa0e8.png">

Note: Conflicting endpoints generate one error per conflicting set of endpoints due to the implementation of `groupInconsistentMetadataById` and `imObjectIds`. This is done to ensure that error messages are terse, but may pose errors if there are some assumptions made surrounding `imObjectIds`.

Related to https://github.com/hasura/graphql-engine-mono/pull/473 (Allow Inconsistent Metadata (v2) #473 (Merged))

---

### Kodiak commit message

Changes the validation to use inconsistent metadata objects for REST endpoint issues.

#### Commit title

Inconsistent metadata for REST endpoints

GitOrigin-RevId: b9de971208e9bb0a319c57df8dace44cb115ff66
2021-03-10 05:26:10 +00:00
Sameer Kolhar
eccefff925 console: permissions support for sql server
Co-authored-by: Aleksandra Sikora <9019397+beerose@users.noreply.github.com>
GitOrigin-RevId: 1dce9fff909ccf34e904c785116462ce16b8c44b
2021-03-10 03:51:03 +00:00
Rikin Kachhia
ff8867c7b6 docs: add workaround to change region for cloud v2.0 projects
GitOrigin-RevId: deb7db4d70793b3ca3b7df222909ca1c2db8003d
2021-03-09 21:28:34 +00:00
Aravind K P
4abc2061fe cli: support inherited roles in metadata
GitOrigin-RevId: f70f199e8ef5c9b859250673bcb7de766400748c
2021-03-09 20:21:03 +00:00
Karthikeyan Chinnakonda
71beba0c54 server: add experimental features in the alpha config API
GitOrigin-RevId: b4841e3dbea8340f8fad638359f3b1cb28188db6
2021-03-09 18:46:42 +00:00
hasura-bot
7e69d3628d docs: add seeds documentation to the CLI config reference
GITHUB_PR_NUMBER: 6323
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/6323

Co-authored-by: Todd Heslin <1883112+toddheslin@users.noreply.github.com>
GitOrigin-RevId: e47d0c62b06e4f4782378318fcfa368406f20096
2021-03-09 16:33:15 +00:00
Naveen Naidu
266f7315a2 docs: Add metadata db link in index of server configuration use case
GitOrigin-RevId: 1c2c4c7c65c6e01ddbec7e589d8644bdb5e856ed
2021-03-09 13:30:33 +00:00
hasura-bot
35168876ec docs: add permissions to config v2 metadata format
GITHUB_PR_NUMBER: 6314
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/6314

Co-authored-by: Funmilayo E. Olaiya <35759534+codeliezel@users.noreply.github.com>
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
GitOrigin-RevId: 43722c20992a4ef0520ee69f3138a97e988f8412
2021-03-09 11:59:20 +00:00
Jigyasu Arya
36a6c36f6d docs: update cloud project collaborators screenshots
GitOrigin-RevId: 8acfe781d27d09d688a293d09fe624c0499c8417
2021-03-09 10:13:46 +00:00
Karthikeyan Chinnakonda
0a7d634326 server: fix issue when remote relationship col has a custom GQL name
GitOrigin-RevId: ca45383020d0e8f80afb445ab8bb240cc1505ea9
2021-03-09 09:25:29 +00:00
Praveen Durairaju
3ad42ed540 docs: add webinar links
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
GitOrigin-RevId: d5b680ce50bfa331bbead32ffe8ad7ba95a6b51f
2021-03-09 08:37:34 +00:00
Aravind K P
ae92ac4941 cli: rename flag --database to --database-name
GitOrigin-RevId: 37fb8dd4f82c2b68f87013e5ec87d5b2dab8853f
2021-03-09 06:44:37 +00:00
Aravind K P
d18e172662 cli: allow relative paths in !include directives
GitOrigin-RevId: c4928e8a1e8918b1a24774ccafbcc5839574f5d7
2021-03-09 05:57:45 +00:00
Rikin Kachhia
8357142001 docs: add v2.0 upgrade related docs
- add [page](https://deploy-preview-814--hasura-docs-mono.netlify.app/graphql/core/databases/connect-db.html) on connecting databases
- add [page](https://deploy-preview-814--hasura-docs-mono.netlify.app/graphql/cloud/projects/move-project-v2.html) to move 1.3 cloud projects to 2.0
- add [section](https://deploy-preview-814--hasura-docs-mono.netlify.app/graphql/core/migrations/upgrade-v3.html#continue-using-config-v2) on continue using config v2 with v2.0 projects

GitOrigin-RevId: 5353466425f1c33d987037b739213a30e87e0efa
2021-03-08 15:43:35 +00:00
Aravind K P
f6ca551df4 cli: support mssql sources
GitOrigin-RevId: 4b1a63c8dc342ae4001b16c4b1dce282092d5c6f
2021-03-08 12:00:34 +00:00
Karthikeyan Chinnakonda
92026b769f [Preview] Inherited roles for postgres read queries
fixes #3868

docker image - `hasura/graphql-engine:inherited-roles-preview-48b73a2de`

Note:

To be able to use the inherited roles feature, the graphql-engine should be started with the env variable `HASURA_GRAPHQL_EXPERIMENTAL_FEATURES` set to `inherited_roles`.

Introduction
------------

This PR implements the idea of multiple roles as presented in this [paper](https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/FGALanguageICDE07.pdf). The multiple roles feature in this PR can be used via inherited roles. An inherited role is a role which can be created by combining multiple singular roles. For example, if there are two roles `author` and `editor` configured in the graphql-engine, then we can create a inherited role with the name of `combined_author_editor` role which will combine the select permissions of the `author` and `editor` roles and then make GraphQL queries using the `combined_author_editor`.

How are select permissions of different roles are combined?
------------------------------------------------------------

A select permission includes 5 things:

1. Columns accessible to the role
2. Row selection filter
3. Limit
4. Allow aggregation
5. Scalar computed fields accessible to the role

 Suppose there are two roles, `role1` gives access to the `address` column with row filter `P1` and `role2` gives access to both the `address` and the `phone` column with row filter `P2` and we create a new role `combined_roles` which combines `role1` and `role2`.

Let's say the following GraphQL query is queried with the `combined_roles` role.

```graphql
query {
   employees {
     address
     phone
   }
}
```

This will translate to the following SQL query:

```sql

 select
    (case when (P1 or P2) then address else null end) as address,
    (case when P2 then phone else null end) as phone
 from employee
 where (P1 or P2)
```

The other parameters of the select permission will be combined in the following manner:

1. Limit - Minimum of the limits will be the limit of the inherited role
2. Allow aggregations - If any of the role allows aggregation, then the inherited role will allow aggregation
3. Scalar computed fields - same as table column fields, as in the above example

APIs for inherited roles:
----------------------

1. `add_inherited_role`

`add_inherited_role` is the [metadata API](https://hasura.io/docs/1.0/graphql/core/api-reference/index.html#schema-metadata-api) to create a new inherited role. It accepts two arguments

`role_name`: the name of the inherited role to be added (String)
`role_set`: list of roles that need to be combined (Array of Strings)

Example:

```json
{
  "type": "add_inherited_role",
  "args": {
      "role_name":"combined_user",
      "role_set":[
          "user",
          "user1"
      ]
  }
}
```

After adding the inherited role, the inherited role can be used like single roles like earlier

Note:

An inherited role can only be created with non-inherited/singular roles.

2. `drop_inherited_role`

The `drop_inherited_role` API accepts the name of the inherited role and drops it from the metadata. It accepts a single argument:

`role_name`: name of the inherited role to be dropped

Example:

```json

{
  "type": "drop_inherited_role",
  "args": {
      "role_name":"combined_user"
  }
}
```

Metadata
---------

The derived roles metadata will be included under the `experimental_features` key while exporting the metadata.

```json
{
  "experimental_features": {
    "derived_roles": [
      {
        "role_name": "manager_is_employee_too",
        "role_set": [
          "employee",
          "manager"
        ]
      }
    ]
  }
}
```

Scope
------

Only postgres queries and subscriptions are supported in this PR.

Important points:
-----------------

1. All columns exposed to an inherited role will be marked as `nullable`, this is done so that cell value nullification can be done.

TODOs
-------

- [ ] Tests
   - [ ] Test a GraphQL query running with a inherited role without enabling inherited roles in experimental features
   - [] Tests for aggregate queries, limit, computed fields, functions, subscriptions (?)
   - [ ] Introspection test with a inherited role (nullability changes in a inherited role)
- [ ] Docs
- [ ] Changelog

Co-authored-by: Vamshi Surabhi <6562944+0x777@users.noreply.github.com>
GitOrigin-RevId: 3b8ee1e11f5ceca80fe294f8c074d42fbccfec63
2021-03-08 11:15:10 +00:00
Kali Vara Purushotham Santhati
34b611ae43 cli: fix extension of generated seeds file
close https://github.com/hasura/graphql-engine/issues/6422

GitOrigin-RevId: 2cbf4a64598e7ef8866cedb46686a8ec4642a63d
2021-03-08 08:30:17 +00:00
Aravind K P
3bfa6834a8 cli: add precondition checks for config v3 update command
GitOrigin-RevId: 62f786ea8fc8d14deb0e78bbbdc2467b7a4e0e9e
2021-03-08 06:58:49 +00:00
Naveen Naidu
f55df228fe Server: Add Event Trigger Metrics
- [x] **Event Triggers Metrics**
  - [x] Distribution of size of event trigger fetches / Number of events fetched in the last `event trigger fetch`
  - [x] Event Triggers: Number of event trigger HTTP workers in process
  - [x]  Event Triggers: Avg event trigger lock time (if an event has been fetched but not processed because http worker is not free)

#### Sample response
The metrics can be viewed from the `/dev/ekg` endpoint

```json
{
"num_events_fetched":{
      "max":0,
      "mean":0,
      "count":1,
      "min":0,
      "variance":null,
      "type":"d",
      "sum":0
   },
 "num_event_trigger_http_workers":{
      "type":"g",
      "val":0
   },
"event_lock_time":{
      "max":0,
      "mean":0,
      "count":0,
      "min":0,
      "variance":0,
      "type":"d",
      "sum":0
   },
```

#### Todo
- [ ]  Group similar metrics together (Eg: Group all the metrics related to Event trigger, How do we do it??)

Closes: https://github.com/hasura/graphql-engine-mono/issues/202
GitOrigin-RevId: bada11d871272b04c8a09d006d9d037a8464a472
2021-03-07 05:25:24 +00:00
Antoine Leblanc
5a1f71b3bc server/mssql: fix parsing of text column values
GitOrigin-RevId: c4692cdc254af074f70cdceb78c7dc6211e7e084
2021-03-05 18:33:16 +00:00
Kali Vara Purushotham Santhati
6d04f587b4 cli: follow symlinks in migrations directory
GitOrigin-RevId: 66840f2b087be3c7660115c5e7158574997f0292
2021-03-05 17:14:17 +00:00