v1.0.0-beta.6
Pre-releaseChangelog
EDIT(10-Sept): Breaking change
A minor breaking change with this release has been identified; some type names have been modified to make them more consistent with others. Here's a list of modified type-names:
integer_comparison_exp->Int_comparison_expboolean_comparison_exp->Boolean_comparison_expreal_comparison_exp->Float_comparison_exptext_comparison_exp->String_comparison_expvarchar_comparison_exp->String_comparison_exp
Support for GraphQL Enums
Single-column Postgres tables (or two-columns, where the second column is a documentation comment) can now be exposed as Enums in the GraphQL schema so that enum values can be explicitly represented and typechecked.
Creating Enums
Here's how you can configure Enums:
🎛 Using metadata APIs
- Adding a new table as Enums: An optional
is_enumkey has been added to thetrack_tablemetadata API that lets you specify that a table is to be exposed as an Enum. - Setting an existing tracked table as Enum: A new
set_table_is_enummetadata API allows specifying whether an already-tracked table should be used as an Enum table.
🖥 Using the console
- Adding a new table as Enums
- Create a table as usual (the table must have only 1 or 2 columns) and add some data in it:
Let's say we want to create an Enum for months of the year:Let's also add some test data into this table:CREATE TABLE months_of_the_year ( month text PRIMARY KEY, description text );
INSERT INTO months_of_the_year (month, comment) VALUES ('January', 'named after the Latin word for door (ianua)'), ('February', 'named after the Latin term februum, which means purification')
- Head to the
Modifysection for the table and toggle theSet table as enumoption and confirm.
- Create a table as usual (the table must have only 1 or 2 columns) and add some data in it:
- Exposing an existing tracked table as Enum
- Head to the
Modifysection for the table and toggle theSet table as enumoption and confirm.
- Head to the
Note: The GraphQL Spec mandates that you not have empty Enum lists (in this case, tables). Using any of the above methods with empty tables will result in an error.
Using Enums
- To restrict values for a column in a table to those from an enum, first, you need to set up a foreign key to the column of the enum table with the enum values
- If the enum table has been tracked and set as an enum table, the GraphQL schema will be updated to reflect Enums and the references to it in tables:
type rain_log { id: Int! rainfall: Numeric! month: months_of_the_year_enum! } enum months_of_the_year_enum { "named after the Latin word for door (ianua)" January "named after the Latin term februum, which means purification" February }
- If you head to Graphiql, you'll notice that:
- you can pick the enum value in Explorer from a drop-down
- you can use the name of the enum value directly rather than providing a string
🧭 🗺 Support for Raster ST_Intersect functions
Some of the overloaded variants of the PostGIS raster ST_Intersects function are now available as the following GraphQL operators for raster columns in boolean expressions:
_st_intersects_rast->boolean ST_Intersects(raster <raster-col>, raster <raster-input>)_st_intersects_nband_geom->boolean ST_Intersects(raster <raster-col>, integer nband, geometry geommin)_st_intersects_geom_nband->boolean ST_Intersects(raster <raster-col> , geometry geommin, integer nband=NULL)(with and without nband values)
Usage:
query ($raster_input: raster) {
table_with_raster_col(where: {rast_col: {_st_intersects_rast: $raster_input}}){
id
rast_col
}
}Note: raster_input is a raw String value of raster data.
Please see docs for more details.
🛠️ Bug Fixes and other changes
-
The server now uses named notation instead of positional notation for function arguments to prevent issues with the generated SQL if any of the arguments is not specified. (fix #2730) (#2777)
-
The server now shuts down gracefully for HTTP requests i.e. it stops accepting new connections, waits for all connections to be drained before shutting down. It also forcefully kills all pending connections after 30 seconds. This change does not deal with gracefully shutting down websocket connections, something that will be handled in a subsequent PR. 📣 Shoutout to @lorenzo for submitting this PR 🙏 🎉 (close #2698) (#2717)
-
Minor fixes in console & CLI (#2527, #2536, #2798, #2765, #2763, #2617)