OpenMCF logoOpenMCF

Loading...

OCI NoSQL Table

Deploys an Oracle Cloud Infrastructure NoSQL table with DDL-defined schema, configurable throughput capacity (provisioned or on-demand), and optional secondary indexes. Freeform tags are auto-populated from metadata labels.

What Gets Created

When you deploy an OciNosqlTable resource, OpenMCF provisions:

  • NoSQL Table — an oci_nosql_table resource in the specified compartment. The table schema is defined entirely through a DDL statement (CREATE TABLE or ALTER TABLE), which is OCI NoSQL's native schema mechanism. Freeform tags are automatically derived from metadata labels.
  • Secondary Indexes — zero or more oci_nosql_index resources, one per entry in the indexes list. Each index is immutable; any change to an existing index forces its recreation. Indexes support plain columns and JSON field paths within JSON-typed columns.

Prerequisites

  • OCI credentials configured via environment variables or OpenMCF provider config (API Key, Instance Principal, Security Token, Resource Principal, or OKE Workload Identity)
  • A compartment OCID where the NoSQL table will be created — either a literal value or a reference to an OciCompartment resource
  • A valid DDL statement — CREATE TABLE for new tables; ALTER TABLE for schema evolution. The table name in the DDL must match the name field.

Quick Start

Create a file nosql-table.yaml:

apiVersion: oci.openmcf.org/v1
kind: OciNosqlTable
metadata:
  name: my-nosql-table
  labels:
    openmcf.org/provisioner: pulumi
    pulumi.openmcf.org/organization: my-org
    pulumi.openmcf.org/project: my-project
    pulumi.openmcf.org/stack.name: dev.OciNosqlTable.my-nosql-table
spec:
  compartmentId:
    value: "ocid1.compartment.oc1..example"
  name: users
  ddlStatement: >-
    CREATE TABLE users (
      id STRING,
      data JSON,
      PRIMARY KEY(id)
    )
  tableLimits:
    maxReadUnits: 50
    maxWriteUnits: 50
    maxStorageInGbs: 10

Deploy:

openmcf apply -f nosql-table.yaml

This creates a NoSQL table with provisioned throughput (50 read units, 50 write units) and 10 GB of storage. The table OCID is exported as a stack output.

Configuration Reference

Required Fields

FieldTypeDescriptionValidation
compartmentIdStringValueOrRefOCID of the compartment where the NoSQL table will be created. Can reference an OciCompartment resource via valueFrom.Required
namestringTable name. Must match the table name used in ddlStatement. Changing this forces recreation.Minimum length 1
ddlStatementstringDDL statement defining the table schema. Use CREATE TABLE for new tables or ALTER TABLE for schema evolution.Minimum length 1
tableLimitsTableLimitsThroughput and storage limits for the table. See sub-table below.Required

Optional Fields

FieldTypeDefaultDescription
isAutoReclaimableboolfalseWhen true, the table can be automatically reclaimed by OCI after an idle period. Changing this forces recreation.
indexesIndex[][]Secondary indexes on the table. Each index is immutable; any change requires recreation. See sub-table below.

TableLimits

FieldTypeDefaultDescription
capacityModeCapacityModeprovisionedHow throughput is allocated. Allowed values: provisioned, on_demand. When on_demand, read and write units are ignored.
maxReadUnitsint32—Maximum sustained read throughput limit. Required when capacityMode is provisioned or unspecified.
maxWriteUnitsint32—Maximum sustained write throughput limit. Required when capacityMode is provisioned or unspecified.
maxStorageInGbsint32—Maximum storage in GB that the table can use.

Cross-field validation: When capacityMode is provisioned (or unspecified), both maxReadUnits and maxWriteUnits must be greater than zero.

Index

FieldTypeDescription
namestringIndex name. Used as the resource key in the IaC module. Minimum length 1.
keysIndexKey[]Columns included in the index. Minimum 1 item.

IndexKey

FieldTypeDescription
columnNamestringName of the column to index. Required.
jsonFieldTypestringIf the column is of type JSON, the scalar type of the JSON field being indexed (e.g., "STRING", "INTEGER", "NUMBER"). Optional.
jsonPathstringIf the column is of type JSON, the dot-separated path to the field being indexed (e.g., "address.zipCode"). Optional.

Examples

Minimal Provisioned Table

A simple key-value table with provisioned throughput — suitable for development or low-traffic workloads:

apiVersion: oci.openmcf.org/v1
kind: OciNosqlTable
metadata:
  name: dev-kv
  labels:
    openmcf.org/provisioner: pulumi
    pulumi.openmcf.org/organization: my-org
    pulumi.openmcf.org/project: my-project
    pulumi.openmcf.org/stack.name: dev.OciNosqlTable.dev-kv
spec:
  compartmentId:
    value: "ocid1.compartment.oc1..example"
  name: kv_store
  ddlStatement: >-
    CREATE TABLE kv_store (
      key STRING,
      value JSON,
      PRIMARY KEY(key)
    )
  tableLimits:
    maxReadUnits: 50
    maxWriteUnits: 50
    maxStorageInGbs: 10

On-Demand Throughput with Indexes

A table with on-demand capacity and secondary indexes for query flexibility:

apiVersion: oci.openmcf.org/v1
kind: OciNosqlTable
metadata:
  name: events-table
  labels:
    openmcf.org/provisioner: pulumi
    pulumi.openmcf.org/organization: my-org
    pulumi.openmcf.org/project: my-project
    pulumi.openmcf.org/stack.name: staging.OciNosqlTable.events-table
spec:
  compartmentId:
    value: "ocid1.compartment.oc1..example"
  name: events
  ddlStatement: >-
    CREATE TABLE events (
      event_id STRING,
      source STRING,
      created_at TIMESTAMP(3),
      payload JSON,
      PRIMARY KEY(event_id)
    )
  tableLimits:
    capacityMode: on_demand
    maxStorageInGbs: 100
  indexes:
    - name: idx_source
      keys:
        - columnName: source
    - name: idx_created_at
      keys:
        - columnName: created_at

JSON Field Indexing

A table that indexes specific fields within a JSON column:

apiVersion: oci.openmcf.org/v1
kind: OciNosqlTable
metadata:
  name: orders-table
  labels:
    openmcf.org/provisioner: pulumi
    pulumi.openmcf.org/organization: my-org
    pulumi.openmcf.org/project: my-project
    pulumi.openmcf.org/stack.name: prod.OciNosqlTable.orders-table
  env: prod
  org: acme
spec:
  compartmentId:
    value: "ocid1.compartment.oc1..example"
  name: orders
  ddlStatement: >-
    CREATE TABLE orders (
      order_id STRING,
      customer_id STRING,
      details JSON,
      created_at TIMESTAMP(3),
      PRIMARY KEY(SHARD(customer_id), order_id)
    )
  tableLimits:
    capacityMode: provisioned
    maxReadUnits: 200
    maxWriteUnits: 100
    maxStorageInGbs: 50
  indexes:
    - name: idx_status
      keys:
        - columnName: details
          jsonFieldType: STRING
          jsonPath: status
    - name: idx_created_at
      keys:
        - columnName: created_at

Using Foreign Key References

Reference an OpenMCF-managed compartment instead of hardcoding the OCID:

apiVersion: oci.openmcf.org/v1
kind: OciNosqlTable
metadata:
  name: ref-nosql
  labels:
    openmcf.org/provisioner: pulumi
    pulumi.openmcf.org/organization: my-org
    pulumi.openmcf.org/project: my-project
    pulumi.openmcf.org/stack.name: prod.OciNosqlTable.ref-nosql
spec:
  compartmentId:
    valueFrom:
      kind: OciCompartment
      name: prod-compartment
      fieldPath: status.outputs.compartmentId
  name: sessions
  ddlStatement: >-
    CREATE TABLE sessions (
      session_id STRING,
      user_id STRING,
      expires_at TIMESTAMP(3),
      PRIMARY KEY(session_id)
    )
  tableLimits:
    maxReadUnits: 100
    maxWriteUnits: 100
    maxStorageInGbs: 25

Stack Outputs

After deployment, the following outputs are available in status.outputs:

OutputTypeDescription
tableIdstringOCID of the created NoSQL table

Related Components

  • OciCompartment — provides the compartment referenced by compartmentId via valueFrom

Next article

OCI Object Storage Bucket

OCI Object Storage Bucket Deploys an Oracle Cloud Infrastructure Object Storage bucket with optional retention rules, lifecycle policies for automatic object transitions and deletions, and cross-region replication. Versioning, auto-tiering, customer-managed encryption, and event emission are configurable at the bucket level. What Gets Created When you deploy an OciObjectStorageBucket resource, OpenMCF provisions: Object Storage Bucket — an ociobjectstoragebucket resource in the specified...
Read next article
Presets
2 ready-to-deploy configurationsView presets →