Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement idea: Import custom content #7865

Open
MikeKry opened this issue Dec 5, 2020 · 11 comments · May be fixed by #14630
Open

Improvement idea: Import custom content #7865

MikeKry opened this issue Dec 5, 2020 · 11 comments · May be fixed by #14630
Assignees
Milestone

Comments

@MikeKry
Copy link
Contributor

MikeKry commented Dec 5, 2020

Hi, I believe that I have searched every bit of documentation of OC but did not found a way to import custom data from excel or something.

Just got idea which could help devs to import their own content and it should not cost too much time to include in OC..

Idea: Use orchard import / export and just modify "ContentStep" to allow inserting, if there is no VersionId and ContentItemId provided and use some ImportContentItemId to avoid duplicates. Then users could use their own way to transform their datasource to json and import these documents.

This could be in theory doable even now, but there is no easy way to generate unique contentitemid from some custom dataset.

What do you think about that?

@fpionnmedia
Copy link

fpionnmedia commented Mar 4, 2021

Hi, I have the exact same issue and haven't found any way to import custom data.

I'm rebuilding a client website and I'm upgrading from an old .NET Framework CMS to a newer CMS (Orchard Core is my preferred candidate for now). I can control the data format (CSV, Excel, JSON, etc.) and I'd like to know if there was a way to import my contents in Orchard Core. There are more than 1,000+ contents in the website and entering them manually is out-of-the-question.

Thanks!

@Skrypt
Copy link
Contributor

Skrypt commented Mar 4, 2021

I will be working on something today for that. At least I think we should be able to import simple content items from an Excel file. Basically it would convert the Excel to JSON so that it can be imported with the Import/Export feature. But I need to try different things first.

@MikeKry
Copy link
Contributor Author

MikeKry commented Mar 4, 2021

Just a thought:
I have ended with implementing my own importer by using code that is already present in OrchardCore.Content.Controllers.ApiController.

Basically what it does = loads csv file, maps fields from csv into json structured content item, calls create/update copied from that api controller.

maybe this could be the way to create some general excel/csv/json importer

@Skrypt
Copy link
Contributor

Skrypt commented Mar 4, 2021

I would generally tend toward using the Import feature we already have which can handle a lot. I don't know about the ApiController. We do bulk insert/updates with the import feature but not with the ApiController. So the logic and whatnot is already working with the Import feature.

Anything that you could share though would be great. 😄

The code part that does "maps fields from csv into json structured content item" I'm interested in 😉

@fpionnmedia
Copy link

@Skrypt Do you have a link on the Import feature? I don't seem the find it in the documentation, nor I do see it in the CMS... (I'm using the master branch, I'll take a look at the dev branch later).

@Skrypt
Copy link
Contributor

Skrypt commented Mar 4, 2021

OrchardCore.Deployment

@hyzx86
Copy link
Contributor

hyzx86 commented Jun 8, 2021

I have a same issue too..
#9616

@hyzx86
Copy link
Contributor

hyzx86 commented Jun 8, 2021

@Skrypt so , we can follow your demo to implement a Relational Database import feature 😊

@Skrypt
Copy link
Contributor

Skrypt commented Jun 9, 2021

You guys can take a look at this project :

https://github.com/dalenewman/Transformalize/blob/master/README.md

@hyzx86
Copy link
Contributor

hyzx86 commented Jun 9, 2021

Great proposal and great project. Thanks for sharing @Skrypt

@sebastienros sebastienros added this to the backlog milestone Jun 10, 2021
@Skrypt
Copy link
Contributor

Skrypt commented Dec 8, 2021

I'm pinging this issue back as I'm curious to know if Nmedia developped a solution for this. @fpionnmedia maybe you should ask Nicolas Hébert about this as I think he's the DB guy. As for myself, I did use the ContentManager directly to import data in Orchard Core. But, doing this again I would probably opt to generate recipe.json files to import the data. But that's not the entire answer.

Of course, if you have a relational database that needs to be built in some specific way you need to build also IndexingProviders before importing the data to fill up these tables. Or you can use the tables as is too.

Also, there is always the option to consume the data from the GraphQL API so that you don't need to change the database data at all. You compose SQL Queries and expose the data with a Schema and then you can consume the database custom tables.

Here, the idea is that if you need relational tables you need to use IndexingProviders to map the data. Nothing prevents you in Orchard Core to use relation between tables but you need to define them through a combination of migrations, recipes and else.

Also, nothing prevents you from using Dapper or EF directly in some custom modules that would be coded with a different approach.

Also building an API to export the data as JSON from Altitude would not be a bad idea.

🎅🏼 ...

@Skrypt Skrypt self-assigned this Dec 8, 2021
@Piedone Piedone linked a pull request May 16, 2024 that will close this issue
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants