Hasura v1.0.0-rc.1 Release Notes
Release Date: 2019-12-02 // over 4 years ago-
๐ Changelog
Accessing session information in functions
Functions can now access session information (JSON) when they are tracked via version 2 of the
track_function
metadata API (which allows specifying an input arg to access session information).Example
Tracking a function and specifying the input arg:
POST /v1/query HTTP/1.1 Content-Type: application/json X-Hasura-Role: admin { "type": "track\_function", "version": 2, "args": { "function": { "schema": "public", "name": "search\_articles" }, "configuration": { "session\_argument": "hasura\_session" } } }
Here's how you can access session information in function:
-- A simple function which accesses role -- information from the 'hasura\_session' argumentCREATE FUNCTION search\_articles(hasura\_session json) RETURNS SETOF articles AS $$ SELECT \* FROM articles where author\_id = (hasura\_session -\>\> 'x-hasura-user-id') $$ LANGUAGE sql STABLE;
๐ Performance (#3012)
๐ง Configure GraphQL engine's internal operations cache size
The size of the operations plan cache used by GraphQL engine can now be limited. To keep the cache size constant, the older entries are discarded using LRU strategy.
Cache size (number of operations) can be configured through the command line argument
--query-plan-cache-size
and the env variableQUERY_PLAN_CACHE_SIZE
(the numbers of GraphQL operations to be cached; 100 is a decent default value for most apps). The accepted values are from 0-65535 (0 disables the cache). When this value isn't specified, an unbounded cache is used which is the current behaviour. A future iteration of this change will change this behavious to default to a fixed cache size.read-only
run_sql
APIA read_only parameter has been added to the
run_sql
metadata API. This sets the postgres transaction mode toReadOnly
. This can be used by the console, etc. to perform select operations without forcing cache/gctx recomputation.Other server & CLI changes
- Minor server changes (#3154, #3414, #3439)
- โ Hasura Tests (#3356,#3434)
- โ Add identifier to
migrate status
command's response in CLI (close #2376) (#3109)
Console changes