Modules​

Every EdgeDB database can contain several modules, each with a unique name. Modules can be used to organize large schemas.

  1. module default {
  2. type BlogPost {
  3. required property title -> str;
  4. required link author -> auth::User;
  5. }
  6. }
  7. module auth {
  8. type User {
  9. required property email -> str;
  10. }
  11. }

Modules can contain a wide range of schema elements: object types (equivalent to tables in SQL), custom scalar types, expression aliases, abstract links and properties, functions, and more. Each of these schema elements has a name; no two elements in the same module can share the same name.

You can split up your schemas however you see fit. Most users put their entire schema inside a single module called default.

Fully-qualified names​

When referencing schema objects in a different module, you must use a fully-qualified name of the form module_name::object_name. In the schema above, note how BlogPost.author points to auth::User. If User and BlogPost were in the same module the auth:: prefix wouldn’t be necessary.

Standard modules​

EdgeDB contains the following built-in modules which come pre-populated with useful types, functions, and operators. These are read-only modules. The contents of these modules are fully documented in Standard Library.

  • std: standard types, functions and other elements of the standard library

  • math: algebraic and statistical functions

  • cal: local (non-timezone-aware) and relative date/time types and functions

  • schema: types describing the introspection schema

  • sys: system-wide entities, such as user roles and databases

  • cfg: configuration and settings