Namespaces

Namespaces organize every other object in ReifyDB. Tables, views, ring buffers, series, dictionaries, and types all live inside a namespace and are addressed as namespace::object. A namespace must exist before you can create objects in it.

Creating a namespace

create namespace registers the container; from then on, every reference to an object inside it uses the :: separator. Run the snippets on this page in order:

$ Create a Namespace and Address Objects Inside It
$ ctrl+enter to run

Names are scoped, not global

Two namespaces can hold objects with the same name without conflict. This is the natural way to separate environments, tenants, or subsystems inside one database: prod::orders and staging::orders are entirely distinct tables.

$ The Same Object Name in Two Namespaces
$ ctrl+enter to run

Idempotent creation

if not exists makes creation safe to re-run, which matters for setup scripts and migrations. The result reports created: false when the namespace was already there:

$ Idempotent Creation with IF NOT EXISTS
$ ctrl+enter to run

Nested namespaces

Namespaces nest. Creating dm_ns::internal places a child namespace under dm_ns, and objects inside it are addressed with the full path, for example dm_ns::internal::audit. Use nesting to group related state without inventing name prefixes:

$ Nested Namespaces
$ ctrl+enter to run

Inspecting namespaces

The system catalog is itself queryable. system::namespaces lists every namespace with its full name, its local name, and the id of its parent - nested namespaces show up as children of the namespace that contains them:

$ Inspect Namespaces via the System Catalog
$ ctrl+enter to run

The system namespace also exposes system::tables, system::views, system::policies, and storage metrics. Reads on system::* are policy-gated for non-root identities.

Where to go next

  • --Tables - the primary shape for authoritative state
  • --Policies - control what each identity may read and write, per namespace or per object
  • --Data Model overview - all primitives at a glance
Reserved namespaces
ReifyDB reserves a few namespaces for itself, most visibly system (the queryable catalog) and default. Your application namespaces live alongside them.