Skip to content

Commit bffe51e

Browse files
committed
docs: note on identical opaquekeys cross-instance
1 parent c8006d1 commit bffe51e

1 file changed

Lines changed: 20 additions & 9 deletions

File tree

oeps/best-practices/oep-0068-bp-content-identifiers.rst

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -202,15 +202,26 @@ with a regex validator. A factory function is available at ``openedx_django_lib.
202202
OpaqueKeys
203203
==========
204204

205-
An ``OpaqueKey`` (defined in `openedx/opaque-keys`_) is an immutable Python object that
206-
bundles together a "key type" and one or more codes to uniquely identify a resource
207-
across an entire Open edX instance. Think of it as a structured, semi-human-readable
208-
string ID that's scoped to one instance.
209-
210-
``OpaqueKey`` is an abstract base class organized into a hierarchy: abstract intermediate
211-
classes represent broad concepts (like ``LearningContextKey`` and ``UsageKey``), while
212-
concrete subclasses represent specific resource types (like ``CourseLocator`` and
213-
``LibraryUsageLocatorV2``). Each concrete type serializes to a predictable string format.
205+
An OpaqueKey (defined in `openedx/opaque-keys`_) is an immutable Python object
206+
that bundles together a "key type" and one or more codes to uniquely identify a
207+
resource across an entire Open edX instance. Think of it as a structured,
208+
semi-human-readable string ID. ``OpaqueKey`` itself is an abstract base class
209+
organized into a hierarchy: abstract intermediate classes represent broad
210+
concepts (like ``LearningContextKey`` and ``UsageKey``), while concrete
211+
subclasses represent specific resource types (like ``CourseLocator`` and
212+
``LibraryUsageLocatorV2``). Each concrete type serializes to a predictable
213+
string format.
214+
215+
OpaqueKeys are designed to identify a resource on a single instance, but
216+
identical OpaqueKeys can naturally occur across instances. For example, if you
217+
export a course from one instance and import it into another with the same
218+
org/course/run codes, all blocks' OpaqueKeys will match. External tools like
219+
catalog integrations, sync workflows, and reporting scripts may rely on
220+
OpaqueKeys to associate data across instances. But, there are limitations:
221+
content can diverge over time, learner data is always
222+
instance-specific, and Open edX itself doesn't enforce any meaning to OpaqueKeys
223+
across instance boundaries. If you need truly global, unambiguous identity
224+
across all instances, use UUIDs instead.
214225

215226
For example:
216227

0 commit comments

Comments
 (0)