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 variable QUERY_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 API

    A read_only parameter has been added to the run_sql metadata API. This sets the postgres transaction mode to ReadOnly. This can be used by the console, etc. to perform select operations without forcing cache/gctx recomputation.

    Other server & CLI changes

    Console changes

    • Display untrackable functions on schema page (close #2249) (#2773)
    • ๐Ÿ›  Fix console data hydration query (close #3342) (#3361)
    • ๐Ÿ‘‰ Make cursor pointer on track and cascade checkboxes in console RawSQL (close #3276) (#3364)
    • ๐Ÿ‘ Allow setting check constraints on existing tables from console (#3383)