1

I'm working with a sample dataset of airports as I continue exploring Slate features for my team. I copied the default airport dataset into my files, so this is a version that I fully own (so presumably no permission issues there). The dataset is properly available in my Slate application since I'm also using it to display and filter data via Phonograph2 queries.

Based on the Phonograph2 docs, I created a new query to add a new airport to the dataset. I'm using the "Table Storage Service" and the "Post Event" endpoint. As a test, I configured my tableEditedEventPostRequest request as:

{
  "primaryKey": {
    "airport": "ABC"
  },
  "payload": {
    "type": "rowAdded",
    "rowAdded": {
      "columns": {
        "display_name": "[ABC] My New Airport"
      }
    }
  }
}

(Once I get this working I'd switch the values out with dynamic values from widgets.)

When I run a test of this query, I get this error response:

{
  "errorCode":"INVALID_ARGUMENT",
  "errorName":"Phonograph2:ReadOnlyTables",
  "errorInstanceId":"17ec990d-5d58-479d-a1b6-5ad033c8c808",
  "parameters":{
    "tableRids":"[ri.phonograph2.main.table.f3f33f6e-801a-4454-98e9-f2df5f170559]",
    "dataInputLocatorRids":"[ri.foundry.main.dataset.6add7c46-d3c9-4056-89b6-a19dbe461ed4]"
  }
}

I'm not finding anything about this error or anything in the docs (so far) about the target dataset being configured as read-only. There aren't settings I can find on the dataset to make it more permissive and I'm already the owner of the dataset. I'd appreciate any insights or tips to get past this road block.

alexbea
  • 1,311
  • 14
  • 25
  • 1
    As you get to learn Slate, I'd recommend that you learn about the "legacy" approach to building read-only apps with the Dataset Postgres sync and the "modern" approach, which uses Object Types from the ontology, which are accessed through the "Platform" tab in the Slate edit UI. In the "modern" approach you don't write "queries" but rather build your backend in a Typescript Functions Code Repository and for writeback you use the Actions widget. – Logan Rhyne Aug 22 '22 at 16:49
  • @LoganRhyne I read somewhere that Workshop might also be the more "modern" tool to use (when applicable) over Slate. Does that sound right as well? – alexbea Aug 22 '22 at 18:48
  • Slate vs Workshop is a little bit more nuanced than that. For my purposes, I find that if I'm building operational tools where I can let the capabilities of Workshop dictate my UI and UX then I can build 10x more quickly in Workshop and get to a polished result. If I want to build something with lots of custom styles or a specific UX, Slate is still the tool for that. – Logan Rhyne Aug 26 '22 at 07:29
  • That makes sense from what we're seeing. Thanks for your thoughts. – alexbea Aug 26 '22 at 14:21

1 Answers1

1

For a Phonograph Table to be "editable" it needs to be associated with a writeback dataset. If you created the sync through the Ontology, which it seems like you did not, you would do this on the "Datasources" configuration tab.

Since it sounds like you created the sync directly from the Dataset Details view (or maybe through the Slate Datasets tab), you should have an option in that configuration to create a new dataset for writeback. All you should need to do is provide a dataset name and folder location.

Logan Rhyne
  • 581
  • 2
  • 5
  • Thanks for your response, Logan. So I gather I can only writeback to registered object types. I had initially been messing around with a plain "raw dataset." It sounds like that might be incompatible with writeback unless I create an Object Type from it. I'm blocked there due to permissions for the moment, but should be getting that unlocked soon. – alexbea Aug 22 '22 at 18:45
  • 1
    Correct - to preserve the guarantees around dataset transactionality and keep the interaction between writeback and pipeline semantics clean, you always have an input dataset that reflects the pipeline state, then your sync (either through object types or straight to phono, preferring the former), and then an output dataset that "plays back" all the edits onto the pipeline input dataset whenever it is built. – Logan Rhyne Aug 26 '22 at 07:31
  • Thank you for your interesting question! It might be useful for me too :) So, if you were to create an application (in Workshop or Slate) that allows users to edit any cell or add rows to input object (dataset), should I save the changes in a specific writeback dataset? Is it correct? The writeback dataset is read-only or can it be used as input to an object/application? Thank u! – Jresearcher Aug 31 '22 at 15:11
  • For most purposes, "Phonograph" is an architecture implementation detail. For building in Slate or Workshop you should sync your dataset to an Object Type, build your apps by accessing the data stored there (different patterns in Workshop v. Slate, but hitting the same backend), and configuring Actions to control the writeback. You can use the output dataset in downstream pipelines, but it would be strange (though not disallowed) to use it to back a different object type. – Logan Rhyne Sep 05 '22 at 09:46