E04 Open Metadata JSON
Use your current course session. Preparation and course runner · R script ↓
E04 Open Metadata JSON
Goal: Open a real offline snapshot.
Prerequisites: E01; jsonlite.
The R block exports a bounded product snapshot through the IDE bridge. MANUAL: Then run DataRaft: Open Metadata JSON and choose the printed file. This also works in VS Code.
training_step(
"E04",
{
bridge_root <- file.path(training_root, "bridge")
dir.create(bridge_root, showWarnings = FALSE)
metadata_path <- file.path(bridge_root, "products.json")
bridge_context <- dataraft.ide::ide_context(
workspace = environment(),
response_root = bridge_root,
contract_root = training_root
)
request <- list(
version = 1L,
operation = "products",
request_id = "training-products",
response_path = metadata_path
)
encoded_request <- jsonlite::base64_enc(charToRaw(as.character(jsonlite::toJSON(
request,
auto_unbox = TRUE
))))
dataraft.ide::ide_request(
gsub("[[:space:]]", "", encoded_request),
bridge_context
)
print(metadata_path)
},
needs = c("E01"),
packages = c("jsonlite"),
enabled = training_options$gui,
optional = TRUE
)Expected result: A snapshot of the actual workspace, not a live connection.
Task: Can this start a live R trial in VS Code?
Show solution
No. Live trials need the Positron R connection.