Commit Graph

565 Commits

Author SHA1 Message Date
Rakesh Emmadi
6d92e4f9db save permissions, relationships and collections in catalog with 'is_system_defined' explicitly (#3165)
* save permissions, relationships and collections in catalog with 'is_system_defined'
* Use common stanzas in the .cabal file
* Refactor migration code into lib instead of exe
* Add new server test suite that exercises migrations
* Make graphql-engine clean succeed even if the schema does not exist
2019-10-21 11:01:05 -05:00
nizar-m
842913f566 Add tests for directives skip and include and basic tests for fragments (fix #3180) (#3185)
* Add tests for directives include and skip
* Add basic tests for fragments
2019-10-20 06:59:41 -05:00
Rakesh Emmadi
d8d21c1487 support computed fields returning scalars or set of tables (close #1387) (#2917) 2019-10-18 13:59:47 +05:30
Alexis King
e01008413e
Track variable uses within query validation for caching (fix #3097) (#3135)
This fix is a little ugly, but it’s the only simple solution without a
significant refactoring that restructures the relationship between
GraphQL/Validate and GraphQL/Resolve. The ugliness should go away if we
implement something like #2801.
2019-10-16 09:33:34 -05:00
Ajeet D'Souza
a66fb42ce2 Make catalog metadata migrations work on all schema versions (fix #2826) (#2379)
* Separate DB and metadata migrations
* Refactor Migrate.hs to generate list of migrations at compile-time
* Replace ginger with shakespeare to improve performance
* Improve migration log messages
2019-10-11 00:13:57 -05:00
Alexis King
c0d7402e15
Fix two enum table reference bugs (fix #2820 and #3010) (#3074)
* Include enum types in schema whenever references are visible (fix #2820)
* Fix RQL parsing for nullable enum table references (fix #3010)
2019-10-10 21:22:16 -05:00
Rakesh Emmadi
b0d60ec14f fix hdb_catalog.hdb_column view (fix #3083) (#3084) 2019-10-10 10:11:17 -05:00
Alexis King
3ef6feb394
server: Fix flaky logging test (#3081)
The changes in 0c74839934 adjusted the
format of error logs slightly to omit fields instead of including them
with null values. However, this was rarely triggered by this test
because it only looks at the first log message, but log messages can
sometimes be written out of order. This makes the test order-agnostic.
2019-10-10 08:40:19 -05:00
Rakesh Emmadi
f3b418c631 support where clause in on_conflict of insert mutation (close #2795) (#3002) 2019-10-09 05:09:20 -05:00
Toan Nguyen
0c74839934 add raw query field for error http log (close #2963) (#3020) 2019-10-07 13:04:33 -05:00
Rakesh Emmadi
8972dfb018 remove brotli compression (#2967)
Although brotli itself is MIT-licensed, the Haskell brotli library that provides bindings to it is GPL-licensed, so we cannot use it unless we get a response on haskell-hvr/brotli#1.
2019-10-05 02:20:50 -05:00
Rakesh Emmadi
084439db7e fix SQL generation if more than one aggregate order_by items present, fix #2981 (#2998) 2019-10-04 23:00:53 -05:00
Vamshi Surabhi
0f143f0ea8 fixes to the subscriptions improvements introduced with #2942 (#3005)
* fix incorrect references to result variables
* remove docs/code related to 'fallback' backend
2019-10-03 14:35:55 -05:00
Tirumarai Selvan
5893cf47ed remove conflict_action type (#2950) 2019-10-03 15:18:49 +05:30
Rakesh Emmadi
55a788594b update custom column names on renaming/dropping columns (#2933) 2019-10-03 13:15:52 +05:30
nizar-m
44da458c81 fix hpc combine error (close #2946) (#2947)
* Fix hpc combine error

* Do not perform ciignore

* xfail test jsonb_has_all

* Bring back ciignore

* Refer jsonb_has_all xfaul to the corresponding issue in graphql-engine-internal
2019-10-02 12:06:27 +05:30
Mark van Driel
342e091f33 Fix typo in warning message (#2949) 2019-09-30 19:24:55 -05:00
Alexis King
18e8fbab1b
Parameterize all SQL values when multiplexing subscription queries (#2942)
Also, add support for explaining subscriptions while we’re at it.
2019-09-30 14:50:57 -05:00
Rakesh Emmadi
79414cb225 add brotli shared lib to packager image (#2924)
Add brotli library dependencies to the server docker image.

The compression feature introduced in #2751 requires brotli shared libraries at runtime. In original PR, adding them to server packager image was missing.
2019-09-24 15:52:50 +05:30
Rakesh Emmadi
8a0615ff70 add gzip brotli compression to http responses (close #2674) (#2751) 2019-09-19 18:24:40 +05:30
Rakesh Emmadi
9bd5826020 allow customising graphql schema for a table (close #981) (#2509)
* allow customizing GraphQL root field names, close #981

* document v2 track_table API in reference

* support customising column field names in GraphQL schema

* [docs] add custom column fields doc in API reference

* add tests

* rename 'ColField' to 'ColumnField'

* embed column's graphql field in 'PGColumnInfo'

-> Value constructor of 'PGCol' is not exposed
-> Using 'parseJSON' to construct 'PGCol' in 'FromJSON' instances

* avoid using 'Maybe TableConfig'

* refactors & 'custom_column_fields' -> 'custom_column_names'

* cli-test: add configuration field in metadata export test

* update expected keys in `FromJSON` instance of `TableMeta`

* use `buildSchemaCacheFor` to update configuration in v2 track_table

* remove 'GraphQLName' type and use 'isValidName' exposed from parser lib

* point graphql-parser-hs library git repo to hasura

* support 'set_table_custom_fields' query API & added docs and tests
2019-09-19 10:17:36 +05:30
Alexis King
d9d47f0062
server: Don’t allow warnings when building in CI (#2892) 2019-09-17 00:00:42 -05:00
Alexis King
54e6439579 Change the way we determine whether or not queries are reusable
This fixes an issue where queries could incorrectly be considered
reusable if a variable was used in two positions: one where it affected
SQL generation and one where it did not.
2019-09-16 22:00:46 -05:00
Alexis King
264d70644b Multiplex all subscriptions, grouping them by their resolved SQL query 2019-09-16 22:00:46 -05:00
Alexis King
171d67899b Add Data.Time.Clock.Units for DiffTime literals and conversions 2019-09-16 22:00:46 -05:00
Ajeet D'Souza
99174cca9b propagate Postgres table comments to GraphQL schema descriptions (close #446) (#2397) 2019-09-16 20:51:11 -05:00
Rakesh Emmadi
e5eb0c4f34 fix row comparison operator in event triggers (fix #2036) (#2868)
Update trigger is failing if any json/geometry columns are present in
event payload rows. Use '*<>' operator instead of '<>' to compare the
internal binary representation of rows if '<>' doesn’t work.
2019-09-12 18:22:01 -05:00
José Lorenzo Rodríguez
5609fba393 Implemented graceful shutdown for websockets (#2827) 2019-09-09 15:26:04 -05:00
Rakesh Emmadi
c148e5753a support optional parameters in database url (close #1709) (#2344) 2019-09-05 15:59:26 -07:00
Rakesh Emmadi
de1ab241f8 allow creating permissions with conditions spanning tables (close #2512) (#2701) 2019-09-05 13:04:53 +05:30
Victor Ferreira
27d85ca6bb fix a typo in limit description of schema (close #2810) (#2811) 2019-09-05 12:47:01 +05:30
Rakesh Emmadi
f7c99689da support intersect filters on raster columns (close #2613) (#2704)
* initial raster support

* _st_intersects_geom -> _st_intersects_geom_nband

* add tests

* update docs

* improve docs

As requested by @marionschleifer

* new type for raster values

Suggested by @lexi-lambda

* replace `SEUnsafe "NULL"` with SENull
2019-08-29 18:37:05 +05:30
Rakesh Emmadi
d9fb0f8780 use named notation for function arguments if any argument is not specified (fix #2730) (#2777)
* use positional arguments in SQL functions
* only allow omitting set of last arguments in functions
* disallow omitting of a non default argument in functions
2019-08-28 14:27:15 -05:00
Tirumarai Selvan
67d3eb3e27 unlock only locked rows during startup (#2778) 2019-08-26 19:41:38 -05:00
Alexis King
78ec906794 server: Include number of enum tables in metrics 2019-08-26 00:54:56 -05:00
Alexis King
c46ecc72dc Refactor non-table functions out of Hasura.RQL.DDL.Table 2019-08-26 00:54:56 -05:00
Alexis King
d4dcd28baa Slightly rearrange and cleanup Hasura.SQL.Value 2019-08-26 00:54:56 -05:00
Alexis King
00862fcad8 Centralize handling of expected PostgreSQL errors 2019-08-26 00:54:56 -05:00
Alexis King
7fa1452ca0 server: Rename a whole bunch of things
* PGTypeSimple → PGTypeScalar
* PGScalarTyped → WithScalarType
* PGColValue → PGScalarValue
* PGColInfo → PGColumnInfo
* PGRawColInfo → PGRawColumnInfo
* mkScalarSessionVar → mkTypedSessionVar
2019-08-26 00:54:56 -05:00
Alexis King
ed26da59a6 Add support for GraphQL enum types via enum table references
These changes also add a new type, PGColumnType, between PGColInfo and
PGScalarType, and they process PGRawColumnType values into PGColumnType
values during schema cache generation.
2019-08-26 00:54:56 -05:00
Alexis King
86663f9af7 Rename PGColType to PGScalarType 2019-08-26 00:54:56 -05:00
Alexis King
d1179f7f98 Don’t use Show for converting PGColTypes to SQL 2019-08-26 00:54:56 -05:00
Alexis King
9be6f706e6 Refactor GCtx to split query and mutation root operations
This mostly simplifies the RootFlds type to make it clearer what it’s
used for, but it has the convenient side-effect of preventing some
“impossible” cases using the type system.
2019-08-26 00:54:56 -05:00
José Lorenzo Rodríguez
c7a2320456 Implemented graceful shutdown for HTTP requests (close #2698) (#2717)
* Listens for SIGTERM as the termination signal
* Stops accepting new connections once the signal is received
* Waits for all connections to be drained, before shutting down
* Forcefully kills all pending connections after 30 seconds

Currently this does not send a close message to websocket clients, I'd
like to submit that change as a separate pull request, but at least this
solve my biggest concern which is not getting confirmation for mutations
while restarting the server.
2019-08-26 00:31:27 -05:00
Tirumarai Selvan
98784212e2 allow configuring timeout for remote schema calls (close #2501) (#2753) 2019-08-23 14:27:19 +05:30
Rakesh Emmadi
8ac78fdaec accept null values in order_by input field (fix #2754) (#2755) 2019-08-22 03:14:27 -05:00
Tirumarai Selvan
7009e77c98 get all Set-Cookie headers (fix #2688) (#2739) 2019-08-19 22:24:13 -05:00
Tirumarai Selvan
46f2ecaa65 don't send the request to the client on HTTP throw (#2738) 2019-08-19 21:18:04 -05:00
Rakesh Emmadi
3527b085fd allow altering type of a column whose permissions defined only with session variables (close #2070) (#2683)
* allow altering type of a column iff session vars are defined in permissions
* use a sum type to define dependency reason
* set jwt expiry test's expiry time to 4 seconds
* derive Data instance for necessary types to simplify 'hasStaticExp'
2019-08-16 16:35:22 -05:00
Alexis King
2aa66ca6f5 Fix websocket race condition in server test suite (fix #2710) (#2712) 2019-08-12 15:14:29 +05:30
José Lorenzo Rodríguez
e952495235 Use SIGINT as the stopsignal in the dockerfile (#2685)
Haskell expects the signal to be `SIGINT`, but the docker default is
`SIGTERM`.
2019-08-11 01:23:06 -05:00
Vamshi Surabhi
52bf885f14
refactor schema.hs into multiple modules (#2661)
Mostly moving around things across modules. No change in
functionality.
2019-08-09 14:49:17 +05:30
Rakesh Emmadi
a03c78854d capture Postgres error code 22025 as HTTP 400 bad request (close #2486) (#2671) 2019-08-08 15:57:42 -05:00
Vamshi Surabhi
a5a07634a5
Merge branch 'master' into dev-scripts-and-doc-tweaks 2019-08-07 12:08:46 +05:30
Anon Ray
b4a0a03631 log when request body parsing fails (fix #2555) (#2556) 2019-08-01 16:21:59 +05:30
Alexis King
84ff3ff01b Set LANG=C.UTF-8 in the docker container (fix #2571) (#2647) 2019-08-01 13:00:07 +05:30
Rakesh Emmadi
6b8a6ca48f dont use sub-query for perm limit if aggregations are absent (#2630) 2019-08-01 05:09:52 +00:00
Brandon Simmons
3e2e14357a Add rebuild-ghc-options to stack.yamls
I found this default a super annoying time waster.
2019-07-31 10:22:50 -04:00
Rakesh Emmadi
db24d3248f schema sync process will not generate garbage data (close #2542) (#2585)
schema syncing logic now requires only a single row in `hdb_schema_update_event`.
2019-07-31 14:31:48 +05:30
Brandon Simmons
bc32130d09 Clarify HASURA_GRAPHQL_EVENTS_FETCH_INTERVAL docs 2019-07-26 01:17:56 -04:00
Brandon Simmons
3a4071af09 Remove some output noise from tests 2019-07-26 01:17:55 -04:00
Brandon Simmons
bc4456eccc Add local development swiss army knife script scripts/dev.sh
At the moment we can...

...run tests in isolation, generating coverage report:

    $ dev.sh test

You can pass args to pytest as well. e.g. to run a specific test:

    $ dev.sh test -k "test_jsonb_has_all"

Launch a postgres container with useful dev defaults, with PostGIS,
cleaning up afterwards:

    $ dev.sh postgres

Build and launch graphql-engine in dev mode, connecting with a
`postgres` launched above

    $ dev.sh graphql-engine
2019-07-26 01:17:35 -04:00
Brandon Simmons
04f90dd35d pytest.exit breaks pytest-xdist and produces a misleading error 2019-07-26 01:16:17 -04:00
Brandon Simmons
7e0f00a229 Remove obsolete Makefile target for tests removed in 6393aba447 2019-07-26 01:16:17 -04:00
Brandon Simmons
02ae91c64d Increase idle GC interval to workaround CPU leak issue (#2581)
This seems to resolve the issue locally (and has worked in the past),
but it's not clear what exactly is going on here (in particular, why
this should resolve what looks like a memory leak). It certainly seems
like a GHC issue of some sort.

Closes #2565
2019-07-24 10:41:52 +05:30
Vamshi Surabhi
4facb3c780 remove support for query templates (#2560)
query templates is a little known feature that lets you template rql
queries and serve them as rest apis. This is not relevant anymore
given the GraphQL interface and getting rid of it reduces the dev
time when adding features in few subsystems.

This feature has never been used outside hasura's internal projects or
documented or exposed through console and hence can safely be removed.
2019-07-23 19:11:34 +00:00
Alexis King
8f9a41ff88 Support casting between PostGIS geometry and geography types in where expressions (close #1983) (#2495)
* server: Bump dependencies to allow Haddock to run successfully

* Support casting between PostGIS geometry and geography types in filters
2019-07-15 14:22:45 +05:30
Vamshi Surabhi
66a2f33fa9 use all available cpu cores by default (#2511)
Use all available cores by default. sets -N rts flag by default. Can be disabled by
setting the `GHCRTS` env variable to `-N1`.
2019-07-12 05:25:15 +00:00
Anon Ray
c797d23a14 fix server tests (#2510) 2019-07-11 10:55:34 +00:00
Anon Ray
f2f14e727b Merge pull request from GHSA-2j98-fw5g-j43v
* fix bug in audience check while verifying JWT

  - previously the check was converting the audience type into a string
  and then comparing with the conf value. all audience types (as it is a
  string or URI) will convert to plain strings
  - use the Audience type from the jose library for comparing

* add docs for audience

* add issuer check as well

* docs minor syntax fix

* skip audience check if not given in conf

* minor docs update

* qualify import jose library
2019-07-11 09:58:39 +00:00
Ajeet D'Souza
92c4cff79e check input for empty strings for metadata api (close #2302) (#2300) 2019-07-11 09:00:45 +00:00
Ajeet D'Souza
605f8633f3 fail on tracking table/function with name conflict (close #2020) (#2383)
Currently, we allow tracking of a table with the same name as an already tracked function, and vice-versa. This causes an issue when querying from GraphQL since it will only query the table and not the function. I've made changes to disallow this by throwing an error.
2019-07-11 07:41:20 +00:00
Anon Ray
8f1e7dbc8d breaking: server logging changes (close #507, close #2171) (#1835) 2019-07-11 05:37:06 +00:00
Vamshi Surabhi
5aa4a46e72
allow fetching gc stats through dev api (#2489) 2019-07-10 17:31:52 +05:30
Vamshi Surabhi
f1cf6d0b17
allow session variables in operators which expect array input (#2475) 2019-07-10 15:49:58 +05:30
Rakesh Emmadi
9eb38e6c96 cache remote schema's introspection query response (fix #1679) (#2089) 2019-07-08 11:21:41 +05:30
Alexis King
6393aba447 Remove obsolete/unmaintained server Haskell test suite (#2472)
* Remove obsolete/unmaintained server Haskell test suite

* Prune some unused server dependencies
2019-07-05 10:56:32 +05:30
Anon Ray
f9863a29c7 update server cabal file to reflect the correct license (#2471) 2019-07-04 10:58:02 +00:00
Ajeet D'Souza
666fd1bbc7 improve code for release channel detection (#2456) 2019-07-04 09:47:17 +00:00
Alexis King
a96adad786 Clarify a few steps involved in running the server test suite (#2467) 2019-07-04 11:43:16 +05:30
Alexis King
fb3794c31a Support Node v12.x and fix tests on macOS (#2455)
* Bump node-sass to version ^4.12.0

This avoids sass/node-sass#2632, which causes compilation failures on
Node v12.x.

* Do most of the work in /pg_dump in Haskell instead of shell

The shell version caused problems on non-Linux systems since it relied
on the non-POSIX -i option for sed, which works slightly differently on
BSD and macOS.
2019-07-03 14:07:13 +05:30
Ajeet D'Souza
b184ce0188 add server version to console html (close #2444) (#2452) 2019-07-02 12:44:29 +00:00
Anon Ray
f31c3b2887 freeze requirements.txt for server tests (#2450) 2019-07-01 13:34:48 +00:00
Rakesh Emmadi
4f9d5952b9 add a make rule to build server docker image locally (#2410) 2019-06-27 11:58:26 +05:30
Ajeet D'Souza
08df38aa8c add name of ci environment to telemetry data (#2382) 2019-06-26 11:53:40 +05:30
Rakesh Emmadi
dc84bb4e77 fix renaming of columns used in insert permission (fix #2398) (#2414) 2019-06-21 16:34:21 +05:30
Shahidh K Muhammed
a8dd3b3deb add api to get server config details (close #1831); add jwt-analyzer (close #1369) (#1925) 2019-06-11 18:59:03 +05:30
Rakesh Emmadi
c3c01beccc support null and default values for function arguments (close #2176, close #2250) (#2282) 2019-06-04 18:13:28 +05:30
Anon Ray
278f26b073 forward set-cookie headers from remote servers (fix #1654) (#2305) 2019-06-04 15:40:28 +05:30
Rakesh Emmadi
31cf7314e2 better change detection when altering foreign key constraints (fix #2060) (#2252)
foreign keys are considered to be dropped only if constraint oid changes
2019-06-03 15:51:55 +05:30
Anon Ray
95a27fba89 fix response for remote schema queries over ws (fix #2246) (#2248) 2019-05-29 17:21:09 +05:30
Rikin Kachhia
7ab9d5eaeb update console favicons to png (#2287) 2019-05-29 10:03:29 +05:30
Rakesh Emmadi
4aabbd5a28 fix and improve help description for stripes and connections (#2278) 2019-05-27 13:46:53 +05:30
Vamshi Surabhi
6aa1216a59
link server with -rtsopts (#2233)
This allows customisation of Haskell's runtime system's parameters.
2019-05-21 14:58:08 +05:30
Rakesh Emmadi
70f4db19ad allow creating multiple relationships which includes the same column (fix #2228) (#2232) 2019-05-21 10:30:33 +05:30
Josha Inglis
277be9074e fix transaction isolation settings on server (#2211) 2019-05-20 19:48:17 +05:30
Rakesh Emmadi
2e19cbee8d keep allowed queries in sync when collections are changed, fix #2221 (#2230) 2019-05-20 15:59:32 +05:30
Rakesh Emmadi
94a8a50410 set allowlist table as system defined on catalog migration, fix #2225 (#2226) 2019-05-20 10:27:32 +05:30
Shahidh K Muhammed
7c89e951f2 serve console assets without any authorization checks (#2201) 2019-05-16 16:58:50 +05:30
Anon Ray
81bdfafd69 ignore content-type header in auth webhook (#2197) 2019-05-16 14:41:15 +05:30
Rishichandra Wawhal
3ef1219fa0 change default endpoint to v1/graphql; remove semver checks (#2181) 2019-05-16 14:38:44 +05:30
Shahidh K Muhammed
76ceb707f4
bundle console assets into server (close #516, close #521, close #2130) (#2192)
This PR builds console static assets into the server docker image at `/srv/console-assets`. When env var `HASURA_GRAPHQL_CONSOLE_ASSETS_DIR=/srv/console-assets` or flag `--console-assets-dir=/srv/console-assets` is set on the server, the files in this directory are served at `/console/assets/*`.

The console html template will have a variable called `cdnAssets: false` when this flag is set and it loads assets from server itself instead of CDN.

The assets are moved to a new bucket with a new naming scheme:

```
graphql-engine-cdn.hasura.io/console/assets/
   /common/{}
   /versioned/<version/{}
   /channel/<channel>/<version>/{}
```

Console served by CLI will still load assets from CDN - will fix that in the next release.
2019-05-16 13:15:29 +05:30
Rakesh Emmadi
0b210cc245 support allow-list for graphql queries (closes #989) (#2075) 2019-05-16 11:43:25 +05:30
Anon Ray
935eaf2211 booleans from env are case insensitve (fix #2177) (#2182) 2019-05-14 16:52:05 +05:30
Anon Ray
7d03e7af2f fix non-200 response for authorization errors on /v1/graphql (#2173) 2019-05-14 16:50:55 +05:30
Rakesh Emmadi
c6f40df6d5 close websocket connection on JWT expiry (fix #578) (#2156) 2019-05-14 11:54:46 +05:30
Anon Ray
ee783e142e fix sending duplicate content-type header to remote schemas (fix #2159) (#2170) 2019-05-13 18:17:01 +05:30
Tirumarai Selvan
36e49ea75b manual event triggers (close #1687) (#2077) 2019-05-13 15:11:07 +05:30
Anon Ray
a21f6cd648 introduce v1/graphql (fix #1368) (#2064)
Changes compared to `/v1alpha1/graphql`

* Changed all graphql responses in **/v1/graphql** endpoint to be 200. All graphql clients expect responses to be HTTP 200. Non-200 responses are considered transport layer errors. 

* Errors in http and websocket layer are now consistent and have similar structure.
2019-05-10 11:35:10 +05:30
Rakesh Emmadi
204cd3514b optimise server startup time (close #1430) (#2120)
1. Reuses postgres connections during startup which reduces the overhead of opening and closing connections. 
2. Faster schema cache building. This is done by fetching all the required data in a single sql statement.
2019-05-08 13:06:42 +05:30
Anon Ray
dfaf7d3a1f fix duplicate headers being sent to remote schema (#2118) 2019-05-06 16:57:34 +05:30
Rakesh Emmadi
c4c36e0ef4 schema cache sync improvements (#2098)
* build schema cache function without db setup

The setup shouldn't happen for sync. The database is already setup by the instance which generated the event. This means that the sync is now faster.

* use SQL loop to drop hdb_views schema views and routines with ordering

This avoids deadlocks when schema is being changed concurrently

* schema sync now only processes the latest event

This becomes useful when a lot of schema change
events happen while we are still processing an
earlier event.
2019-05-03 16:12:26 +05:30
Rakesh Emmadi
b436948e7f update schema cache on a column's null-ability or type changes (fix #2101) (#2106) 2019-05-02 18:01:32 +05:30
Shahidh K Muhammed
71cf017197 add an api to dump postgres schema (close #1939) (#1967) 2019-04-30 14:04:08 +05:30
Vamshi Surabhi
8389a7e273
multiplexed subscription improvements (#2081)
* split stm transactions when snapshotting to make it faster

* mx subs: push to both old and new sinks at the same time

* expose dev APIs through allowed APIs flag
2019-04-30 10:45:23 +05:30
Rakesh Emmadi
39f43bdd59 log inconsistent metadata objects only when there are any (close #2053) (#2058) 2019-04-29 11:52:48 +05:30
Rakesh Emmadi
7779198f54 do not enforce permission limit in aggregations (fix #1837) (#2027) 2019-04-26 13:49:59 +05:30
Rakesh Emmadi
733101bf85 compute dependencies for column operators in permissions (close #2054) (#2055) 2019-04-24 15:58:10 +05:30
Vamshi Surabhi
7151f1387f
fix validation of null values, closes #1981 (#2057) 2019-04-24 13:19:39 +05:30
Vamshi Surabhi
83c3094936
add variable name to the path when there is an error, closes #2050 (#2051) 2019-04-24 12:02:53 +05:30
Vamshi Surabhi
24c0643a6d
Use ByteString to cache introspection response, closes #1942 (#2028)
If we store it as EncJSON, we still need to render it to ByteString
for every request which will result in higher CPU usage
2019-04-18 17:45:07 +05:30
Vamshi Surabhi
35542df93f
candidate id shouldn't be part of the plan in multiplexed subscriptions (#2029) 2019-04-18 16:50:27 +05:30
Rakesh Emmadi
1d7cbc7f24 recover from inconsistent database state (closes #231) (#1863) 2019-04-17 21:59:39 +05:30
Vamshi Surabhi
ce243f5899
multiplexed subscriptions (#1934)
* add types to represent unparsed http gql requests

This will help when we add caching of frequently used ASTs

* query plan caching

* move livequery to execute

* add multiplexed module

* session variable can be customised depending on the context

Previously the value was always "current_setting('hasura.user')"

* get rid of typemap requirement in reusable plan

* subscriptions are multiplexed when possible

* use lazytx for introspection to avoid acquiring a pg connection

* refactor to make execute a completely decoupled module

* don't issue a transaction for a query

* don't use current setting for explained sql

* move postgres related types to a different module

* validate variableValues on postgres before multiplexing subs

* don't user current_setting for queries over ws

* plan_cache is only visible when developer flag is enabled

* introduce 'batch size' when multiplexing subscriptions

* bump stackage to 13.16

* fix schema_stitching test case error code

* store hashes instead of actual responses for subscriptions

* internal api to dump subscriptions state

* remove PlanCache from SchemaCacheRef

* allow live query options to be configured on server startup

* capture metrics for multiplexed subscriptions

* more metrics captured for multiplexed subs

* switch to tvar based hashmap for faster snapshotting

* livequery modules do not expose internal details

* fix typo in live query env vars

* switch to hasura's pg-client-hs
2019-04-17 15:18:41 +05:30
Rakesh Emmadi
bfe53e9d9a fix incorrect default values for inserts after column drop, fix #1991 (#1993) 2019-04-15 12:34:30 +05:30
Shahidh K Muhammed
de24cfd43a read version from env var during server build time (close #1398) (#1897)
* read version from env var at build time (close #1398)

* remove un-used imports, edit makefile

* edit makefile to add new targets and export variables

* only export VERSION in makefile

* read version by executing the script if env var is absent
2019-04-11 09:41:48 +05:30
Rakesh Emmadi
7b5bbb758a fix excessive memory consumption with bulk queries (#1972)
Use 'Strict' State monad instead of 'Lazy' to avoid unevaluated memory thunks
2019-04-09 21:41:06 +05:30
nizar-m
a40bf10b9f run graphql tests on both http and websocket; add parallelism (close #1868) (#1921)
Examples 
1)  `
pytest --hge-urls "http://127.0.0.1:8080" --pg-urls "postgresql://admin@127.0.0.1:5432/hge_tests" -vv
`
2)  `pytest --hge-urls "http://127.0.0.1:8080"   "http://127.0.0.1:8081" --pg-urls "postgresql://admin@127.0.0.1:5432/hge_tests"  "postgresql://admin@127.0.0.1:5432/hge_tests2" -vv
`
### Solution and Design
<!-- How is this issue solved/fixed? What is the design? -->
<!-- It's better if we elaborate -->
#### Reducing execution time of tests
- The Schema setup and teardown, which were earlier done per test method, usually takes around 1 sec. 
- For mutations, the model has now been changed to only do schema setup and teardown once per test class.
-  A data setup and teardown will be done once per test instead (usually takes ~10ms).
- For the test class to get this behaviour, one can can extend the class `DefaultTestMutations`. 
    - The function  `dir()` should be define which returns the location of the configuration folder.
    - Inside the configuration folder, there should be 
        - Files `<conf_dir>/schema_setup.yaml` and `<conf_dir>/schema_teardown.yaml`, which has the metadata query executed during schema setup and teardown respectively
        - Files named `<conf_dir>/values_setup.yaml` and `<conf_dir>/values_teardown.yaml`. These files are executed to setup and remove data from the tables respectively. 

#### Running Graphql queries on both http and websockets
- Each GraphQL query/mutation is run on the both HTTP and websocket protocols
- Pytests test parameterisation is used to achieve this
- The errors over websockets are slightly different from that on HTTP
   - The code takes care of converting the errors in HTTP to errors in websockets

#### Parallel executation of tests.
- The plugin pytest-xdist helps in running tests on parallel workers.
- We are using this plugin to group tests by file and run on different workers.
- Parallel test worker processes operate on separate postgres databases(and separate graphql-engines connected to these databases). Thus tests on one worker will not affect the tests on the other worker.
- With two workers, this decreases execution times by half, as the tests on event triggers usually takes a long time, but does not consume much CPU.
2019-04-08 12:52:38 +05:30
Rakesh Emmadi
3708f95036 fix input argument types for custom SQL functions (close #1952) (#1953) 2019-04-08 12:28:56 +05:30
Tirumarai Selvan
cab1aa0cb1 fix update_event_trigger query not persisting the changes (#1950)
fix #1949
2019-04-05 17:50:46 +05:30
Tirumarai Selvan
d53c70cbcd specify better error msgs for remote schema conflicts (fix #1805) (#1904) 2019-04-03 06:48:19 +05:30
Vamshi Surabhi
ada35c2236 add user information to transactions in ws protocol (fix #1867) (#1869)
This bug introduced with the refactor in 739ff80a51.
2019-03-26 16:38:27 +05:30
Vamshi Surabhi
8e9a6a25a9 bump haskell-docker-packager version (#1870)
The previous version didn't include libgcc_s.so.1 in rootfs. We never encountered an error before as it was most likely packaged by busybox.
2019-03-26 15:26:15 +05:30
Vamshi Surabhi
739ff80a51 refactor graphql query execution logic (#1855) 2019-03-25 23:55:25 +05:30
Tirumarai Selvan
36781199d0 breaking: drop id from event_triggers table (fix #1840) (#1857) 2019-03-25 22:40:52 +05:30
Toan Nguyen
560c31f9fd add a json path argument to query values inside json columns (close #1598) (#1661) 2019-03-25 19:15:35 +05:30
Shahidh K Muhammed
b8700cce70
add spatial predicates for geography columns (close #1674) (#1735)
This PR adds support for PostGIS spatial predicates on geography columns. The predicates are _st_d_within and _st_intersects.
2019-03-25 17:59:52 +05:30
Rikin Kachhia
1ba382193e update console and docs favicons (close #1485) (#1760) 2019-03-25 15:42:56 +05:30
Vamshi Surabhi
d61c90f1b7
validate relationship definitions on startup (#1849) 2019-03-25 14:26:29 +05:30
Shahidh K Muhammed
2274e2748b Revert "reduce server build time on ci (#1836)"
This reverts commit cbd6bb1f15.
2019-03-25 09:49:23 +05:30
Anon Ray
cbd6bb1f15 reduce server build time on ci (#1836)
Due to a misconfiguration in the caching logic, a server was building dependencies on every build. This fixes it to reduce server build time.
2019-03-22 18:11:15 +05:30
Rakesh Emmadi
5bafdce9a3 fix delete mutation returning incorrect data (fix #1794) (fix #1763) (#1827)
From `alpha-40` we've been using a `WHERE` clause to fetch required rows and generate mutation response. This has a few limitations like the requirement of a primary key/unique constraint. This also returns inconsistent data on `delete` mutation as mentioned in #1794. 
Now, we're using `VALUES (..)` (refer [here](https://www.postgresql.org/docs/current/sql-values.html)) expression to form virtual table rows in `SQL` to generate mutation response.

Internal changes:-
- Not to use primary key/unique constraint columns:-
  - Revert back to `ConstraintName` from `TableConstraint` in `TableInfo` type
  - Remove `tcCols` field in `TableConstraint` type
  - Modify `table_info.sql` and `fetchTableMeta` function `SQL`
- A test case to perform `delete` mutation and returning relational objects.
2019-03-22 12:38:42 +05:30
Vamshi Surabhi
ac1749c764 add type, variable information to input value's ast (close #21) (#1809) 2019-03-20 12:01:49 +05:30
Shahidh K Muhammed
a5890623c4
specify needed node version, clarify setup instructions (close #1754) (#1815) 2019-03-19 10:42:50 +05:30
Tirumarai Selvan
8615c306ec add for update skip locked to fetch query (#1798) 2019-03-19 10:00:44 +05:30
Vamshi Surabhi
24dcefb142
use bytestring builder to represent encoded json (#1800) 2019-03-18 21:52:21 +05:30
Anon Ray
961f1af528 send error not connection_error on query validation errors (fix #1790) (#1792) 2019-03-17 17:30:54 +05:30
Vamshi Surabhi
c7346fd55a bump stackage to lts 13 and refer to hasura's pg-client-hs (#1747) 2019-03-14 20:25:33 +05:30
Rakesh Emmadi
e32f5a1fb1 sync metadata cache across multiple instances connected to same db (closes #1182) (#1574)
1. Haskel library `pg-client-hs` has been updated to expose a function that helps listen to `postgres` notifications over a `channel` in this [PR](https://github.com/hasura/pg-client-hs/pull/5)
2. The server records an event in a table `hdb_catalog.hdb_cache_update_event` whenever any `/v1/query` (that changes metadata) is requested. A trigger notifies a `cache update` event via `hasura_cache_update` channel
3. The server runs two concurrent threads namely `listener` and `processor`. The `listener` thread listens to events on `hasura_cache_update` channel and pushed into a `Queue`. The `processor` thread fetches events from that `Queue` and processes it. Thus server rebuilds schema cache from database and updates.
2019-03-12 11:16:27 +05:30
Rakesh Emmadi
5f274b5527 fix mutation returning when relationships are present (fix #1576) (#1703)
If returning field contains nested selections then mutation is performed in two steps
1. Mutation is performed with returning columns of any primary key and unique constraints
2. returning fields are queried on rows returned by selecting from table by filtering with column values returned in Step 1.

Since mutation takes two courses based on selecting relations in returning field, it is hard to maintain sequence of prepared arguments (PrepArg) generated while resolving returning field. So, we're using txtConverter instead of prepare to resolve mutation fields.
2019-03-07 15:54:07 +05:30
Vamshi Surabhi
98405fdc0c
allow x-hasura- req headers for jwt unauth role, closes #1686 (#1689) 2019-03-05 17:54:47 +05:30
Anon Ray
d9882fcb03 fix remote queries/mutations to work over websocket (fix #1619) (#1621) 2019-03-05 16:39:02 +05:30
Anon Ray
02d80c9ac6 read cookie while initialising websocket connection (fix #1660) (#1668)
* read cookie while initialising websocket connection (fix #1660)

* add tests for cookie on websocket init

* fix logic for tests

* enforce cors, and flag to force read cookie when cors disabled

  - as browsers don't enforce SOP on websockets, we enforce CORS policy
  on websocket handshake
  - if CORS is disabled, by default cookie is not read (because XSS
  risk!). Add special flag to force override this behaviour

* add log and forward origin header to webhook

  - add log notice when cors is disabled, and cookie is not read on
  websocket handshake
  - forward origin header to webhook in POST mode. So that when CORS is
  disabled, webhook can also enforce CORS independently.

* add docs, and forward all client headers to webhook
2019-03-04 13:16:53 +05:30
Vamshi Surabhi
f794653b69
update event triggers on rename operations (#1684) 2019-03-01 19:29:24 +05:30
Rakesh Emmadi
377290a058 breaking: correct (de)serialisation of postgres numeric types in json (fix #1523) (#1662) 2019-03-01 17:15:04 +05:30
Rakesh Emmadi
6c20ca8a55 allow renaming tables, columns and relationships (close #79) (#1542) 2019-03-01 14:47:22 +05:30
nizar-m
1fa66dc622 add option to disable metadata and graphql apis (close #1088) (#1650) 2019-02-28 19:23:03 +05:30
Shahidh K Muhammed
097bfb6bfa revert "forward response headers from remote servers (#1664)"
This reverts commit c19fe35f4e.
2019-02-28 17:20:56 +05:30
Anon Ray
c19fe35f4e forward response headers from remote servers (fix #1654) (#1664) 2019-02-28 17:15:07 +05:30
Rakesh Emmadi
c731fde1e3 enforce column presets of update permission with upserts (fix #1647) (#1653) 2019-02-23 16:06:42 +05:30
Tirumarai Selvan
7851015cb2 refactor event processing logic (#1639) 2019-02-22 17:55:36 +05:30
Rakesh Emmadi
0833d35088 generate scalar types for SQL function arguments (fix #1632) (#1633)
Also involved a refactor of the internals to localise the context needed for each field
2019-02-22 15:57:38 +05:30
Igor Pashev
7ccc91ec4f remove grep from server makefile (#1614)
awk can do all the job.
2019-02-19 12:20:54 +05:30
nizar-m
f83a8e591f rename access-key to admin-secret (close #1347) (#1540)
Rename the admin secret key header used to access GraphQL engine from X-Hasura-Access-Key to X-Hasura-Admin-Secret.

Server CLI and console all support the older flag but marks it as deprecated.
2019-02-14 15:07:47 +05:30
Tirumarai Selvan
51dd6157e1 remove wreq and set response timeout (close #1477) (#1501) 2019-02-14 13:07:59 +05:30
Anon Ray
199a24d050 add support for multiple domains in cors config (close #1436) (#1536)
Support for multiple domains (as CSV) in the `--cors-domain` flag and `HASURA_GRAPHQL_CORS_DOMAIN` env var.

Following are all valid configurations (must include scheme and optional port):
```shell
HASURA_GRAPHQL_CORS_DOMAIN="https://*.foo.bar.com:8080"
HASURA_GRAPHQL_CORS_DOMAIN="https://*.foo.bar.com, http://*.localhost, https://example.com"
HASURA_GRAPHQL_CORS_DOMAIN="*"
HASURA_GRAPHQL_CORS_DOMAIN="http://example.com, http://*.localhost, http://localhost:3000, https://*.foo.bar.com, https://foo.bar.com"
```

**Note**: top-level domains are not considered as part of wildcard domains. You have to add them separately. E.g - `https://*.foo.com` doesn't include `https://foo.com`.

The default (if the flag or env var is not specified) is `*`. Which means CORS headers are sent for all domains.
2019-02-14 11:28:38 +05:30
Vamshi Surabhi
68bb898b24
Update CONTRIBUTING.md 2019-02-14 10:47:27 +05:30
Vamshi Surabhi
392a37f12a
Update CONTRIBUTING.md 2019-02-14 10:46:14 +05:30
Rakesh Emmadi
2054bdc44e do not allow overloading already tracked functions (#1563) 2019-02-14 09:35:18 +05:30
Rakesh Emmadi
cba732d439 support column presets in update mutation (closes #1449, closes #1464) (#1473)
Also restricts altering type of columns which are used in presets
2019-02-11 18:15:30 +05:30
Tirumarai Selvan
9a6fa7fafc add delivery info to event payload (close #1476) (#1517)
Adds the following to the event payload:
```
    "delivery_info": {
        "max_retries": 0,
        "current_retry": 0
    }
```
2019-02-07 18:07:28 +05:30
Anon Ray
4f6462e98f add config for stringified hasura claims in JWT (fix #1176) (#1538) 2019-02-05 17:34:16 +05:30
Rakesh Emmadi
96f8b05326 don't allow altering tracked SQL functions type to VOLATILE (fix #1546) (#1547) 2019-02-05 11:27:03 +05:30
nizar-m
68da491d9d Improve error message when no operation specs are provided during event trigger creation (close #998) (#1541) 2019-02-01 15:07:38 +05:30
Rakesh Emmadi
4ef50d95c7 hdb_views should always be cleared before building schema cache (#1513) 2019-01-29 15:39:58 +05:30
Rakesh Emmadi
3caff9b924 support jsonb and postgis operators in permissions (#1461)
* support jsonb and geometry operators on RQL bool exps, close #1408

* add tests for jsonb operators in /v1/query

TODO:-
-> add tests for geometry (postgis) operators

* support parsing session variables for st_d_within and has_key ops

-> Add tests for boolExp operators and select permissions

* improve parsing $st_d_within op's json value logic
2019-01-28 23:16:31 +05:30
Anon Ray
91c19ecf3d test jwt with invalid signtaure and expired token (#1492) 2019-01-28 22:22:43 +05:30
Anon Ray
4ae44f7b5d add functions to server telemetry (#1500) 2019-01-28 22:16:44 +05:30
nizar-m
32387ba964 support union and interface types in remote schema (close #1276) (#1361) 2019-01-28 22:15:10 +05:30
Anon Ray
39bc3acffd fix conversion when merging remote schema scalars with hasura (fix #1244) (#1497) 2019-01-28 21:01:37 +05:30
Shahidh K Muhammed
11e7c3f9d6 add anonymous telemetry (#1401) 2019-01-28 19:25:28 +05:30
nizar-m
8e3b8f51c9 Support default values (in inputvalue) from the remote schema (close #1491) (#1493) 2019-01-28 18:08:38 +05:30
Rakesh Emmadi
fc73d4d30a handle the absence of any update operators, fix #1448 (#1475) 2019-01-28 12:54:24 +05:30
Tirumarai Selvan
e590144d02 send session variables in event trigger payload (close #1328) (#1458) 2019-01-28 11:42:52 +05:30
Rakesh Emmadi
0bf2457e23 allow exposing postgres functions through GraphQL interface (close #333) (#1073) 2019-01-25 09:01:54 +05:30
Rakesh Emmadi
ae63ed9603 simplify SQL generated for _eq and _neq operators in GraphQL API (#1466) 2019-01-25 00:04:44 +05:30
Vamshi Surabhi
5514b40de2
dependencies of object relationship now includes remote table, closes #1441 (#1442) 2019-01-24 18:56:13 +05:30
nizar-m
bf67e5e246 update Server Contributing.md (close #1370) (#1414) 2019-01-20 15:19:56 +05:30
nizar-m
916caf1575 add flag to disable prepared statements (close #1392) (#1396) 2019-01-18 19:50:41 +05:30
Rakesh Emmadi
d91d7e658a optimise 'run_sql' query, closes #1362 (#1406) 2019-01-18 16:15:59 +05:30
Rakesh Emmadi
7ff1c8829a add PostGIS operators in boolean expressions (closes #1051) (#1372) 2019-01-17 11:51:38 +05:30
Nathan Stitt
1b9540f996 allow specifying network interface with "server-host" option (#1280)
* allow specifying network interface with "server-host" option

* store host value as a HostPreference

* document server-host options
2019-01-11 16:37:13 +05:30
Rakesh Emmadi
1008c08420 accept null and empty values for relationships during insert, closes #1352 2019-01-11 12:52:58 +05:30
Anon Ray
e9121a903f fix typo in pgcrypto error message (fix #1322) (#1331) 2019-01-08 14:35:25 +05:30
Rakesh Emmadi
e2fe078b89 fix fetching primary key columns for non table owners (close #1269) (#1300) 2019-01-04 16:36:05 +05:30
Rakesh Emmadi
41e487d203 fix auth hook mode env var (fix #1270) (#1285)
Support HASURA_GRAPHQL_AUTH_HOOK_MODE env var for --auth-hook-mode flag.
Drop support for HASURA_GRAPHQL_AUTH_HOOK_TYPE env var in next major
update (beta/stable)
2019-01-04 12:12:36 +05:30
Vamshi Surabhi
380fdad468 update constraint enum types when a new constraint is added (#1287)
* update metadata when constraints on a table are altered, fix #240

* capture only unique or primary constraints in tableinfo
2019-01-03 09:28:12 +05:30
Rakesh Emmadi
4d9d1505dd improve startup logging, close #1236 (#1258) 2019-01-02 16:54:17 +05:30
Vamshi Surabhi
be1d9414f8
diff's query should account for table having no columns (#1256) 2018-12-21 15:24:22 +05:30
Vamshi Surabhi
ea4d2644e8
local console during development (#1252)
* console now works on local builds of the server

1. local console assets can be served at /static/ by a build time flag
'local-console'. This can be set with stack as follows:
   `stack build --flag graphql-engine:local-console`
2. the --root-dir option is removed which was used as a temporary hack
for serving graphiql
3. remove server's graphiql source code
2018-12-21 13:21:02 +05:30
Rakesh Emmadi
63acd0e7b2 generate aggregate order by types only if relevant columns are present, closes #1243 (#1248) 2018-12-20 19:31:54 +05:30
Rakesh Emmadi
d4e6ffcae8 revert back to older cli options parser type (#1231) 2018-12-19 17:08:33 +05:30
Vamshi Surabhi
c28fbd3f98
faster retrieval of table information from postgres (#1235) 2018-12-19 16:11:06 +05:30
Vamshi Surabhi
8feff0daca
clear event_triggers when clear_metadata is called, closes #1232 (#1233) 2018-12-19 12:04:27 +05:30
Rakesh Emmadi
b5bbb966f2 add consolePath in console.html template (#1222)
Server templates `consolePath` key in `window.__env` object in console html template.
If server is hit at `/console/table/author` then `window.__env` in served html looks like
```
{
   consoleMode: "server",
   urlPrefix: "/console",
   consolePath: "/console/table/author",
   isAccessKeySet: true
}
```
2018-12-18 15:09:01 +05:30
Rakesh Emmadi
3026c49087 apply update permissions for upsert mutations (#628) 2018-12-15 21:40:29 +05:30
Tirumarai Selvan
6de17b303f drop trigger functions on updating event triggers (#1214) 2018-12-15 10:35:29 +05:30
Anon Ray
2bcec7dca9 point jose version to 0.8.0.0 on github (closes #983) (#1202) 2018-12-14 09:51:29 +05:30
Rakesh Emmadi
708a29fc89 refactor server cli code, add more cli options & version command (closes #51, #144, #1090, #1195) (#1200) 2018-12-14 08:51:41 +05:30
Vamshi Surabhi
ec8b2c80b5
refactor to remove warnings especially with orphan instances (#1163)
* remove phase one/two distinction and hdbquery typeclass

* move extensions to default-extensions

* switch to LazyTx which only acquires a connection if needed

* move defns from TH module into Ops module

* remove tojson orphan instance for http exception

* remove orphan instance for dmlp1

* getTopLevelNodes will not throw any exceptions
2018-12-13 12:56:15 +05:30
Rakesh Emmadi
ff6c95c2f8 allow ordering with aggregated fields (close #1039) (#1042) 2018-12-12 18:28:39 +05:30
Anon Ray
77cbf12bb7 merge types with same structure in remote schema (closes #1112, #1135) (#1145) 2018-12-12 17:31:18 +05:30
Rakesh Emmadi
9fbd407374 parse graphql input objects and arrays as scalar values (close #1132) (#1137) 2018-12-04 19:51:58 +05:30
Rakesh Emmadi
29ba490296 conform to graphql subscription and error spec (close #1056, close #1059) (#1126) 2018-12-04 19:07:38 +05:30
Rakesh Emmadi
3ea20bc4d7 allow authentication webhook with POST (close #1138) (#1147) 2018-12-03 16:49:08 +05:30
Vamshi Surabhi
db1f6c1a39
remove dependency on 'first' aggregate, closes #1085 (#1089) 2018-11-27 21:40:54 +05:30
Rakesh Emmadi
1e896a9c42 handle null values for input arguments, fix #1113 (#1123) 2018-11-27 17:54:51 +05:30
Anon Ray
0d14c13f98 metadata should be backwards compatible for remote schemas (fix #1120) (#1121) 2018-11-27 16:56:10 +05:30
Anon Ray
a509a86eaa implement internal graphql server for remote schema tests (#1117)
* implement internal graphql server for remote schema tests

* add one more graphql endpoint and more tests

* add missing dependency
2018-11-26 18:38:16 +05:30
Rakesh Emmadi
8df23ad6c9 use postgres IN experssion for _in operator (fix #1109) (#1111) 2018-11-26 15:39:55 +05:30
Anon Ray
512ee6fb9f adds basic support for remote schemas/schema stitching (#952) 2018-11-23 18:32:46 +05:30
Shahidh K Muhammed
6fb24d5bf0 update server dockerfile, install manifests and docs (#1097) 2018-11-23 14:47:31 +05:30
Rakesh Emmadi
58fe579497 support Postgres's DISTINCT ON (close #1040) (#1099) 2018-11-23 07:23:56 +05:30
Dimitrios Mavrommatis
ef6e53a407 change descending ordering to nulls first (fix #1008) (#1009) 2018-11-22 10:28:18 +05:30
Rakesh Emmadi
030f094de9 handle empty array for _in and _nin operators, fix #1075 (#1076) 2018-11-21 12:28:29 +05:30
Vamshi Surabhi
47dcae1614
fix sql generation for boolean expressions, closes #853 (#1037)
When using self referential relationships in boolean expressions, the exists clause incorrectly uses the table names to qualify columns which will be the same for parent table and the child table. This is now fixed by generating unique aliases as we traverse down the relationships.
2018-11-16 18:10:23 +05:30
Rakesh Emmadi
1539d6b5a6 server port can be set with HASURA_GRAPHQL_SERVER_PORT env variable, closes #1033 (#1038) 2018-11-15 10:25:39 +05:30
Rakesh Emmadi
b719e82e89 add statistical aggregate operations and count on columns (close #1028) (#1029) 2018-11-14 18:29:59 +05:30
Tirumarai Selvan
317efb81f1 event triggers: take webhook url from env (close #966) (#968) 2018-11-14 12:43:01 +05:30
Rakesh Emmadi
9af591e2cb remove x-hasura-access-key header from logs (fix #1016) (#1017) 2018-11-13 14:05:44 +05:30
Tirumarai Selvan
d4d31838cb quote function and trigger names, allow hyphen in trigger name (#1012) 2018-11-13 11:28:55 +05:30
Rakesh Emmadi
8c1700e76f improve SQL generation for '_in' operation (close #1013) (#1014) 2018-11-12 18:57:47 +05:30
Rakesh Emmadi
80de0e019a do not generate prefix for column identifiers in agg select, fix #1004 (#1005) 2018-11-12 12:58:46 +05:30
Abhinav Srivastava
c776cd84a6 update multiple files (#943) 2018-11-08 12:02:57 +05:30
Anupam Dagar
e1253e595a add missing serve command to server contributing guide (#910) 2018-11-04 08:11:06 +05:30
Rakesh Emmadi
999580481c allow specifying a list of columns that can be inserted (close #250) (#917) 2018-11-02 20:38:38 +05:30
Rakesh Emmadi
0e9d6994ac refactor nested insert mutation and fix returning (fix #844) (#852)
* improved nested insert execution logic

* integrate error path, improve executing 'withExp' and improve tests

* add more readable types in '/Resolve/Insert.hs'

* set conflict context just before executing WITH expression
2018-11-02 19:31:01 +05:30
Shahidh K Muhammed
f7da89e10a
remove enable console from docker cmd and add it as env var (close #907) (#938) 2018-11-02 15:59:01 +05:30
Rakesh Emmadi
1a91399298 extract session variables from relational bool expression (fix #960) (#961) 2018-11-02 15:06:33 +05:30
Rakesh Emmadi
0803738df1 refactor select query generation (#941) 2018-10-31 18:21:20 +05:30
Tirumarai Selvan
c5c2ed2389 give precedence to retry-after header over retry conf (#954) 2018-10-31 17:22:41 +05:30
Tirumarai Selvan
b40807c9ec change type of fetch interval to milliseconds (#939) 2018-10-30 20:50:18 +05:30
Mohammed Rishad
58ccddc76e pep8 fixes for python files (#875) 2018-10-30 14:51:58 +05:30
nizar-m
4f091e5e5b gitignore generated .tix files in pytest folder (#924) 2018-10-29 19:55:37 +05:30
nizar-m
0ffb0478b9 Tests for server with access control, and some more tests (#710)
* 1) Tests for creating permissions
2) Test for constraint_on with GraphQL insert on_conflict

* Run tests with access key and webhook

* Tests for GraphQL query with quoted columns

* Rewrite test-server.sh so that it can be run locally

* JWT based tests

* Tests with various postgres types

* For tests on select queries, run setup only once per class

* Tests for v1 count queries

* Skip teardown for tests that does not modify data

* Workaround for hpc 'parse error when reading .tix file'

* Move GeoJson tests to the new structure

* Basic tests for v1 queries

* Tests for column, table or operator not found error cases on GraphQL queries

* Skip test teardown for mutation tests which does not change database state, even when it returns 200.
2018-10-28 23:57:49 +05:30
Vamshi Surabhi
58582be644
fix parsing webhook response, closes #890 (#894) 2018-10-28 22:01:24 +05:30
Tirumarai Selvan
baf7c493bc respect retry-after header on event trigger response (#525) 2018-10-26 21:58:03 +05:30
Vamshi Surabhi
8b0082eac1
clean up user variables parsing logic and fix explain api (#869) 2018-10-26 21:27:22 +05:30
Rakesh Emmadi
fb842fde6f optional 'set' field in insert permissions, closes #216 (#622) 2018-10-26 20:28:20 +05:30
Rakesh Emmadi
f6ed169219 allow ordering using columns from object relationships (closes #463) (#672)
* allow ordering using columns from object relationships, close #463

* validate table fields in nested insert

* add tests

* add docs

* change 'table_order_by' type from enums to ordered map

* remove unwanted code from 'Schema.hs' file

* 'AnnGObject' is not list of field name and value tuple

* update docs for new order_by type

* use 'InsOrdHashMap' for 'AnnGObj'

* handle empty fields in order_by

* remove '_' prefixes for asc/desc

* fix the changed order_by syntax across the repo
2018-10-26 17:27:33 +05:30