I'm migrating an ancient blog from PostgreSQL to Contentful. I'd like to use data from the old blog posts to fill in Contentful entries' sys.createdAt, sys.updatedAt, sys.publishedAt, and sys.firstPublishedAt.
I've read through:
the Content Management API docs
the contentful-migration docs
this page on scripting migrations with Contentful
this article on the same topic.
Didn't find anything.
I've read a couple of examples where people create their own publishedAt field in a content type rather than add to sys date properties.
I tried to replicate the data structure of exported content as exported by contentful-cli and filled in the date properties with my own data:
// I edited these dates
"createdAt": "2020-09-05T13:14:00.768Z",
"updatedAt": "2021-06-05T13:14:20.303Z",
...
"publishedAt": "2021-06-05T13:14:20.303Z",
"firstPublishedAt": "2020-10-05T13:14:20.303Z",
Then I imported the JSON file with the same CLI. This did not work.
I also tried importing a file exported with contentful space export with no custom edits in it. It turns out, Contentful always uses the time of import for all entry date properties regardless of the dates in the exported file.
It says somewhere in relation to the Content Delivery API that we can't edit sys. But I've not seen it explicitly stated that we can't do it with the CMA or the migration tools. Is it really not possible to add those details for the purpose of migration?
Contentful DevRel here. 👋
You're correct. The sys object contains system-managed metadata and its fields can not be changed programmatically. It doesn't matter if you use the official tooling.
(The only exception is that you can specify sys.id on entry creation.)
I've read a couple of examples where people create their own publishedAt field in a content type rather than add to sys date properties.
👆 That is the recommended way to go. For any data you want to control, create new fields and manage them however you like.
Related
We use RICS that auto import our product information into Akeneo. Every time there is a new COLOR, I get an error for example: Property "color" expects a valid reference data code. The code "BALTIK/LAKE" of the reference data "color" does not exist under CONNECT/CONNECTION SETTINGS/ERROR MONITORING, so I then manually add each color under REFERENCE DATA/(_T) SIMPLE ASSETS. Is there a way Akeneo can be set up to auto add these new colors in the REFERENCE DATA as there are hundreds of new colors needing to be added frequently?
It depends on which type of attribute do you have.
If you have attribute type Reference entity simple link there is no job to import the records. You can do this by writing a simple script using REST API.
If you have attribute type Simple select there is dedicated import job, and you can prepare CSV or XLSX with all possible values. Then you can import it to PIM. You can do this via API too.
Additionally, there is no possibility to new option/record on the go while importing the product. There are a couple of plugins in marketplace which does that, but it's really bad for catalog hygiene and can cause a lot of problems for system operators.
I am using Kentico v10.0, I have 400+ records that needed to be enter.
Currently the data was stored using custom table. Is that a way for me to import all the data from an excel file? I think no one likes to do data entry jobs...
So by using the Kentico Import Toolkit is able to achieve what I request.
But I found another problems which there are many empty fields like the picture below:
I have no idea what to put as the default value while importing, so i decided to leave it empty.
Will it affect anythings in the future if these fields are NULL?
Or there is a way to set the default value from the kentico itself? So I don't need to bother the default value while importing.
Use the Kentico Import Toolkit. You can import into your site directly from the Excel sheet. You can also use SQL Server Management Studio to import the custom table data. I'd not recommend using SSMS for anything other than custom table data though.
I would suggest in this order.
Kentico import Toolkit. Very versatile and can be used for other things too. You don't have to worry about those null values unless those values are supposed to be mandatory non-null values.
Second option would be to connect to Kentico's DB using SSMS and import the data in the desired table.
My question is pretty simple. I am working on Kentico 9 with its SQL Server database which contains several tables which had been added directly from the SQL Management Studio by an external contractor. The fact is that those tables are being used to store custom content which will be displayed for a site, but, in the code they don't have the code for making queries. I mean, they don't have Info and Provider classes.
https://docs.kentico.com/display/K82/Retrieving+database+data+using+ObjectQuery+API
According with this, all tables into the Kentico database can be accessed by invoking methods on these classes, but I don't have it this time.
Something like this, it will not work if I use my table name:
var user = UserInfoProvider.GetUserInfo("administrator");
var items = CustomTableItemProvider.GetItems("MyTable")
.TopN(10)
.WhereEquals("ItemCreatedBy", user.UserID)
.OrderBy("ItemCreatedWhen");
My question is:
can I query any table by its name?
One last thing:
I cannot declared those table as "custom table" because it seems to be a bug in the CMS.
Or you can pull data using your own SQL query:
var ds = ConnectionHelper.ExecuteQuery("select ....", null, QueryTypeEnum.SQLQuery);
Nevertheless I would recommend to create a custom class inside a custom module (much more robust than custom tables) instead and use the generated Info and InfoProvider classes to get and manipulate data.
I think an object has to be registered within the system (created through Kentico UI or API) in order to be pulled from DB with object query.
So I'd choose one of the following options:
Use Entity Framework or something similar to work with that data
Create appropriate custom tables or even custom module and push data there. Not sure why you can't create a custom table... What is an error you're getting?
If you need to present data on the UI only (without processing on the back end) - use just custom queries
Hope this helps.
If you are accessing in code then you could do it the good old fashioned way. If you want to pull data from the database to display on the website you could also do so by creating a custom query and using a transformation to display the fields, then use a repeater on the page to display the transformed data. Alternatively you can use a SQL datasource with a basic repeater, but you still have to create a transformation to display the data. Both methods allow you to access the data in the tables from within the CMS UI, no need to touch any code behind.
If your objective is to read data from these database tables to transform on webpage e.g. using CMS Repeater webpart, you can simply create custom query(s) in Kentico itself and load data using it. You can find the detail here on how to create custom custom queries and load data using it.
On the other hand you can also write your custom classes and define the custom methods where you can pull data using your own SQL query like this:
var ds = ConnectionHelper.ExecuteQuery("select ....", null, QueryTypeEnum.SQLQuery);
Lastly I don't think there should be any issue to create custom table instead of those direct DB tables, only thing we have to ensure code name of custom table should be unique means don't try to use exact same name because it'll cause exception due to same table name already exist in DB. You can please share exception you getting while creating custom table so that I can help you out further.
I want a metadata field getting values from database record. This metadata field should be added to document.
Can anyone provide a solution to my requirement.??
I presume you are using Liferay 6.1.
Web Content Structures
As for Web Content, you could programmatically create a JournalStructure (see JournalStuctureLocalServiceUtil) and populate the list of possible values for your structure field with values coming out of the database. You can put this "import code" inside a batch job, so your structure field and the values inside the external database are always in sync.
Document Metadata
How to do this with Metadata Sets is probably more interesting, as not only Dynamic Data Lists and Documents & Media use this in Liferay 6.1; as of 6.2, Web Content structures will utilize the same metadata API in favor of the old Journal API.
For this to implement, check out the xsd column of the DDMStructure table. It has more or less the same format as the XML for a JournalStructure, however there are more options available. Use DDMStructureLocalServiceUtil#addStructure to add such a new structure. Again, run this inside a batch so you always have the latest external DB values.
I have a problem in my sharepoint document library structure. Currently the document library consiste of folder sub-folder structure to store a document categorywise. Now our client want to redefine this folder structure with a metadata structure.
Can any one tell me how can I use metadata instade of folder sub folder structure..?
any related articles or links will be appriciated.
Thanks
Sachin
As already stated, you need to use columns for the metadata, preferably through a new Content Type. After creating this Content Type, you need to attach it to the library and convert all documents to it. Lastly, you also need to modify the views of the library, e.g. depending on your metadata you might only want to display certain columns or filter them.
There is an excellent whitepaper from Microsoft on Content Types available here:
http://technet.microsoft.com/en-us/library/cc262729.aspx
You can also read more about content type planning on Technet:
http://technet.microsoft.com/en-us/library/cc262735.aspx
And here's some info about Views:
http://office.microsoft.com/en-us/sharepointtechnology/HA100215771033.aspx
You must define columns for the metadata fields you want to have, create a content type that includes these columns, and assign this content type to your documents.
You might also change the default view of your document library, or create a new view, to make the new metadata columns visible.