Set
set
– set one or multiple session-level parameters
set module module ;
set alias alias as module module ;
set global name := expr ;
Variations
- set module module
-
Set the default module for the current section to module.
For example, if a module
foo
contains typeFooType
, the following is how the type can be referred to:Copy# Use the fully-qualified name. select foo::FooType; # Use the WITH clause to define the default module # for the query. with module foo select foo::FooType; # Set the default module for the current session ... set module foo; # ... and use an unqualified name. select FooType;
- set alias alias as module module
-
Define alias for the module.
For example:
Copy# Use the fully-qualified name. select foo::FooType; # Use the WITH clause to define a custom alias # for the "foo" module. with bar as module foo select bar::FooType; # Define "bar" as an alias for the "foo" module for # the current session ... set alias bar as module foo; # ... and use "bar" instead of "foo". select bar::FooType;
- set global name := expr
-
Set the global variable name to the specified value.
For example:
Copy# Set the global variable "current_user_id". set global current_user_id := <uuid>'00ea8eaa-02f9-11ed-a676-6bd11cc6c557'; # We can now use that value in a query. select User { name } filter .id = global current_user_id;
Examples
Copy
set module foo;
set alias foo AS module std;
set global current_user_id :=
<uuid>'00ea8eaa-02f9-11ed-a676-6bd11cc6c557';
︙
See also |