Set

set – set one or multiple session-level parameters

  1. set module module ;
  2. set alias alias as module module ;
  3. set global name := expr ;

Description

This command allows altering the configuration of the current session.

Variations

set module module

Set the default module for the current section to module.

For example, if a module foo contains type FooType, the following is how the type can be referred to:

  1. # Use the fully-qualified name.
  2. select foo::FooType;
  3. # Use the WITH clause to define the default module
  4. # for the query.
  5. with module foo select foo::FooType;
  6. # Set the default module for the current session ...
  7. set module foo;
  8. # ... and use an unqualified name.
  9. select FooType;

set alias alias as module module

Define alias for the module.

For example:

  1. # Use the fully-qualified name.
  2. select foo::FooType;
  3. # Use the WITH clause to define a custom alias
  4. # for the "foo" module.
  5. with bar as module foo
  6. select bar::FooType;
  7. # Define "bar" as an alias for the "foo" module for
  8. # the current session ...
  9. set alias bar as module foo;
  10. # ... and use "bar" instead of "foo".
  11. select bar::FooType;

set global name := expr

Set the global variable name to the specified value.

For example:

  1. # Set the global variable "current_user_id".
  2. set global current_user_id :=
  3. <uuid>'00ea8eaa-02f9-11ed-a676-6bd11cc6c557';
  4. # We can now use that value in a query.
  5. select User { name }
  6. filter .id = global current_user_id;

Examples

  1. set module foo;
  2. set alias foo AS module std;
  3. set global current_user_id :=
  4. <uuid>'00ea8eaa-02f9-11ed-a676-6bd11cc6c557';

See also

Reference > EdgeQL > Reset