github hasura/graphql-engine v2.26.0-beta.1

latest releases: v2.39.1, cli/v2.39.1, v2.39.0...
pre-release12 months ago

Changelog

Highlights

Introducing Logical Models and Native Queries (Cloud / Enterprise edition only)

The Hasura GraphQL Engine automatically generates a schema that includes fields for querying, mutating, and subscribing to data changes and events, but sometimes you need more flexibility over your data model. We are announcing two new features which combine to handle any use case you can think of:

  • Logical Models allows you to define custom GraphQL types that don't directly map to a database object, giving you more flexibility and control over your Hasura-generated GraphQL schema.

  • With Native Queries, you'll be able to harness the full power of SQL within Hasura without the need to create database objects that require DDL privileges.

You might find Native Queries useful for many reasons:

  • Use the full power of SQL that Hasura might not provide access to through the typical table API, such as GROUP BY, window functions, or scalar functions.
  • Provide custom arguments to the users of your API to greatly expand its flexibility.
  • Encapsulate sophisticated filtering with a query, allowing your users to provide a single argument rather than having to understand how to manipulate the data.
  • Work with the advanced features of your database to improve performance.
  • Write a compatibility layer around tables, making it easier to change your API without breaking existing clients.
  • Reduce duplication by moving common data manipulation into one place.

Read the docs and check out both of these new features in our May Community Call!

Support for SQL Server stored procedures (Cloud / Enterprise edition only)

SQL Server stored procedures can now be tracked from the Console. This feature is available under the new Native Queries section of the Console.

Support for caching Remote Schemas and Actions when forwarding client headers (Cloud / Enterprise edition only)

Previously, Hasura would not cache Remote Schemas and Actions when forward_client_headers setting was set to true. Now, this limitation has been removed, by adding the client headers as part of the cache key. Now one can use @cached with Remote Schema or Action queries.

Behaviour changes

  • In Action payload transformation, GraphQL Engine will now ignore the x-www-form-urlencoded values which are null

  • Removes the deprecated MySQL implementation. Customers using the deprecated implementation will need to upgrade to the new MySQL implementation based on GraphQL Data Connectors.

  • Data Connector driver tables with known slow performance with local relationship now default to use remote relationships. The currently affected driver is Snowflake. (Cloud / Enterprise edition only)

  • Data Connector DB connections will now be closed when idle for 10 minutes, and connections swapped for new ones when reaching 2 hours alive. This is to prevent issues with timeouts and long-lived connections in certain data sources. (Cloud / Enterprise edition only)

  • This change alters the Snowflake query strategy for queries containing relationships: (Cloud / Enterprise edition only)

    • the motivation for this change was a very significant performance boost, particularly across large datasets
    • instead of local relationships, within Snowflake itself, the new strategy makes uses the HGE to break down complex, relational queries into simple queries for which the results are compiled by HGE at the end
    • queries without relationships will entail, simple, straightforward SQL that will perform in line with the best of the Snowflake engine itself
    • one negative consequence of this change is that certain permission structures (namely, those involving relationships) will no longer be supported
    • additionally, any currently defined "local" relationships will have to be reproduced as "remote" relationships; though that process should be very straightforward
  • (Cloud / Enterprise edition only) Snowflake data sources no longer support local object and array relationships due to query performance issues. To join between tables in the same Snowflake database, please use remote relationships instead where both the source and target data source of the remote relationship are the same Snowflake data source. Any existing object or array relationships defined on Snowflake tables will cause metadata inconsistency errors in this version and will need to be removed and re-created as remote relationships. We hope to return local object and array relationship support in a future version.

    Below are some examples of Snowflake tables defined in Hasura metadata and how you can convert from local relationships to remote relationships for object and array relationships.

    Object Relationship
    Local Relationship (no longer supported) Remote Relationship (use this instead)
    {
      "table": ["Album"],
      "object_relationships": [
        {
          "name": "AlbumArtist",
          "using": {
            "foreign_key_constraint_on": "ArtistId"
          }
        }
      ]
    }
    
    {
      "table": ["Album"],
      "remote_relationships": [
        {
          "name": "AlbumArtist",
          "definition": {
            "to_source": {
              // The name of the source the tables are in
              "source": "snowflake_chinook", 
              "table": ["Artist"],
              "relationship_type": "object",
              "field_mapping": {
                // The columns involved in the FK (Album table -> Artist table)
                "ArtistId": "ArtistId" 
              }
            }
          }
        }
      ]
    }
    
    Array Relationship
    Local Relationship (no longer supported) Remote Relationship (use this instead)
    {
      "table": ["Artist"],
      "array_relationships": [
        {
          "name": "Albums",
          "using": {
            "foreign_key_constraint_on": {
              "table": ["Album"],
              "column": "ArtistId"
            }
          }
        }
      ]
    }
    
    {
      "table": ["Artist"],
      "remote_relationships": [
        {
          "name": "Albums",
          "definition": {
            // The name of the source the tables are in
            "source": "snowflake_chinook",
            "table": ["Album"],
            "relationship_type": "array",
            "to_source": {
              "field_mapping": {
                // The columns involved in the FK (Artist table -> Album table)
                "ArtistId": "ArtistId"
              }
            }
          }
        }
      ]
    }
    

Bug fixes and improvements

Server

  • A new <kind>_untrack_tables metadata API has been added that allows untracking of multiple tables in one API request (docs). This is typically faster than issuing multiple single <kind>_untrack_table API calls, or placing multiple <kind>_untrack_table requests into a bulk API call.
  • A new <kind>_track_tables metadata API has been added that allows tracking of multiple tables in one API request (docs). This is typically faster than issuing multiple single <kind>_track_table API calls, or placing multiple <kind>_track_table requests into a bulk API call.
  • The get_table_info for Data Connector backends can now be called as a prefixed command, such as sqlite_get_table_info.
  • Add HTTP response status to the context of response transforms in Actions and Event Triggers.
  • Fix event processing time metrics calculation and removes Z from the created_at value in the payload sent by the Event Trigger to reflect that the time in the payload may or may not represent a UTC Time. (For e.g., It's DB local time in PG and UTC time in MSSQL)
  • Properly scope root-table references in permissions appearing in boolean expressions on relationships (fix #9283)
  • Add additional error information to the output when an HTTP Exception Error is thrown during Action and Remote Schema execution in dev mode.
  • Add new Prometheus metrics hasura_subscription_total_time_seconds, hasura_subscription_db_execution_time_seconds. (Cloud / Enterprise edition only)
  • Add a new Prometheus metric hasura_events_fetched_per_batch. (Cloud / Enterprise edition only)
  • Add a new Prometheus metric to track cache hit-and-miss requests: hasura_cache_request_count with label status which can have two possible values hit and miss. (Cloud / Enterprise edition only)
    Exposed metric:
    # HELP hasura_cache_request_count Total number of incoming requests for cache lookup
    # TYPE hasura_cache_request_count counter
    hasura_cache_request_count{status="hit"} 0.0
    hasura_cache_request_count{status="miss"} 0.0
    
  • Add configuration for high-cardinality labels for Prometheus metrics (metrics with dynamic labels) (Cloud / Enterprise edition only)

Console

  • Add a feature flag to enable the new permissions user interface
  • Fix issue with renaming databases via the connection management screen
  • Fix object suggested relationships being tracked as array relationships
  • Fix bugs where we wrongly mapped and filtered currently supported relationships.
  • Add a percentage progress indicator while tracking/un-tracking large number of tables in Data Connector-backed databases.
  • Improve handling of connection issues to Data Connector-backed sources. (Cloud / Enterprise edition only)
  • Display a pop-up for users to use caching for queries slower than 1s in API Explorer. (Cloud / Enterprise edition only)
  • Add support for x-www-form-urlencoded payload when using OpenAPI imports. (Cloud / Enterprise edition only)

Data Connectors

  • Fix a bug where database foreign keys defined with non-alphanumeric or underscored names caused Snowflake/Oracle/MySQL/MariaDB data source connection errors. (Cloud / Enterprise edition only)

Don't miss a new graphql-engine release

NewReleases is sending notifications on new releases.