Create and extend a schema
Learn how to create a schema and how to extend an existing schema.
Transcript
Welcome. In this video, I will explain how to create schemas, and I will show you how to update an existing schema. If you are familiar with Adobe Campaign Classic, I will also point out the differences between the two versions. Let’s jump right in and create a schema.
Navigate to the Explorer tab.
And then under Administration, Configuration, you will find the data schemas. Here you can see all data schemas that are available in the product. Let’s create a new one.
So we will create a new table.
I’ve prepared an example. Let me paste that into the field.
As you can see, this is a list of products. That’s a very simple example. It has three attributes being three columns, the product SKU, product title, and product description. All of these are strings. In addition, we will create an internal key on the root node. So we’ll have an additional column which contains the key and it should be auto-generated. We need to make sure that autopk is set to true, as well as autouuid. This is specific to Campaign v8. In v8, the system creates UUIDs. Unlike in v7, where the IDs are numerical IDs and are counted up by one every time a new data set is ingested.
You can also see that by default, the data source is the cloud database. Whereas with V7, it’s the local database. There’s one more thing you need to be aware of.
If you create a table and want it to be exposed to the API and you know you will have a lot of access to this table, unitary calls mainly, updates and so on, then you should enable the staging mechanism by setting autostg to true. If you want to learn more about the staging mechanism, we do have a separate video available on this. So I will save the schema.
You can see it listed here.
Now we need to update the database structure to make sure the changes are applied.
You can see that two tables will be created. The new table that will be located on the cloud database and will contain the list of products. And, because we have enabled the staging mechanism, there’s a second table, which will be on the local database. It is a copy of the first table, so it will contain the same data structure. Let’s take a closer look. Remember, we created a new table with three columns and one internal key. We now have two tabs because we have multiple sources. The first one is for the cloud database. So what will happen there? We will create a new table, that is the list of products with the three attributes, the description, the SKU, and the title, as well as the internal key, which will be the UUID, which will be auto-generated each time a new data set is ingested.
The second tab, the default tab, is a table on the local database, which was created because we enabled the staging mechanism. It is a copy of the first table with some additional attributes.
When I click on Start, it’ll execute the SQL on both sides, first on the cloud database and then on the local one.
Okay, so the tables have been created. When you look at the tables, we now have a table with the products. It has the three attributes plus the key. And we have the local staging table, which of course is still empty. The way these tables will be used is the following. If we want to ingest the data through APIs, we will use the local staging table. If, however, we want to ingest the product list through data management and the batch workflows, we will use the main product table on the cloud database.
Next let’s extend the schema.
We will extend the out-of-the-box operator table.
The table we need to extend is the XTK table.
So let’s add a new attribute.
And we want to extend the operator table.
Let’s see. The table we need is the XTK table.
We’ll add a new attribute, the business unit.
And I will save the extension and update the structure.
Yes, the new column will be added.
So let me execute. Okay, now let’s take a look and see what happened. You will need to refresh the page, and there should be the new attribute, the business unit. We have extended the XTK schema on the local database and due to the data replication mechanism and Campaign v8, the XXL schema on the cloud database was synced and updated as well. You can see it here, but you will not be able to see the XXL table in your UI as all of this happens automatically in the background. If you want to know more about the data replication mechanism, this is covered in a separate video.
So, now you know how to create new schemas and how to extend the schema in Campaign v8. Thank you for watching. -
recommendation-more-help
7a30e547-2454-4e63-af7a-073312f6c5cb