Answers.Body: <p>I think you have to know what you need and what you want to achieve.
  You need to decide if you want to add <a href="https://github.com/craftcms/docs/blob/v3/en/element-types.md" rel="nofollow noreferrer">elements</a> or <a href="http://www.yiiframework.com/doc-2.0/guide-db-active-record.html" rel="nofollow noreferrer">records</a> because there is a huge difference between those two types of objects and how you need to import and implement them</p>
  
  <p><strong>Elements</strong><br>
  Pros:</p>
  
  <ul>
  <li>it does not take a lot of time to make them manageable for clients</li>
  <li>they can use all Craft features (relation fields, lists, edit forms....)</li>
  <li>they are really flexible</li>
  </ul>
  
  <p>Cons:</p>
  
  <ul>
  <li>you'll need a little bit of time to dig into the concept if you are totally new to Craft</li>
  <li>they'll have a record in your <code>elements</code> table so for larger projects you'll have to pay attention at your performance</li>
  </ul>
  
  <p><strong>Records</strong><br>
  Pros<br></p>
  
  <ul>
  <li>easy to handle</li>
  <li>it does not require much time to create/import records since they are standalone and have no requirements</li>
  <li>Yii's activerecord object is really powerful and intuitive in searching records</li>
  <li>they don't create a massive overhead in your db</li>
  </ul>
  
  <p>Cons</p>
  
  <ul>
  <li>If you are going to make your records editable to users/customers in the cp you'll need to create everything on your own (templates/forms....) because they have no field layout and it's a mess to redefine them as elements to use Craft features... I did it once, it was not funny</li>
  <li>You are not able to use Craft relations by default and have to create custom relation tables if you are going to do fancy stuff</li>
  </ul>
  
  <p>After you decided what to use, you have to decide how you would like to proceed. You can create a custom element type or use an existing one (entries, categories) and how complex it needs to be. But without more information from your site it's hard to give any further advice.</p>
  
  <p>I suggest everyone to create a custom plugin for imports to handle them. Due to Crafts/Yii2's plugin management and services it's totally trivial to create a data import because everything is really easy to understand and to manage. You can create a custom controller to fetch the data you need, set the values of your elements/records and use their <code>save</code> functions. The rest happens nearly automatically</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-18T03:52:21.753Z
Answers.Text: Do you know the performance bottleneck for elements? We will use external services for search for example but still we are planing to put over 100k record with 10-20 fields. Guess it will not to slow specially if the search will be external - fron algolia
Answers.UserDisplayName: Visky Máté
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-18T07:35:53.727Z
Answers.Text: 100k should not be that bad. I've never tested the exact number so I can't say for sure. Does your client need to see/manipulate the imported data in the cp? If not records are totally enough
Answers.UserDisplayName: Robin Schambach
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-18T19:09:51.797Z
Answers.Text: Manipukation is needed. Need the flexibility of craft for content management. After import they will have a workflow task to make the content sexy before publising. Anyhow we will test it anyway:) but thx for the hints and links!
Answers.UserDisplayName: Visky Máté
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-15T10:27:23.420Z
Answers.LastActivityDate: 2018-02-15T10:27:23.420Z
Answers.UserDisplayName: Robin Schambach
Body: <p>Is there any best practice how to import info Craft 3 data from external source, or should I backtrack it from the database?</p>
  
Tags: <database><migration>
Title: Database structure for Craft 3 to import from external source?
ThreadText: # Database structure for Craft 3 to import from external source?
  
  (Asked by: username_0 on 2018-02-15)
  
  Is there any best practice how to import info Craft 3 data from external source, or should I backtrack it from the database?
  
  **Tags:** database, migration
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-02-15. Score: 3 | Accepted answer
  
  I think you have to know what you need and what you want to achieve.
  You need to decide if you want to add [elements](https://github.com/craftcms/docs/blob/v3/en/element-types.md) or [records](http://www.yiiframework.com/doc-2.0/guide-db-active-record.html) because there is a huge difference between those two types of objects and how you need to import and implement them
  
  **Elements**  
  Pros:
  
  * it does not take a lot of time to make them manageable for clients
  * they can use all Craft features (relation fields, lists, edit forms....)
  * they are really flexible
  
  Cons:
  
  * you'll need a little bit of time to dig into the concept if you are totally new to Craft
  * they'll have a record in your `elements` table so for larger projects you'll have to pay attention at your performance
  
  **Records**  
  Pros
  
  * easy to handle
  * it does not require much time to create/import records since they are standalone and have no requirements
  * Yii's activerecord object is really powerful and intuitive in searching records
  * they don't create a massive overhead in your db
  
  Cons
  
  * If you are going to make your records editable to users/customers in the cp you'll need to create everything on your own (templates/forms....) because they have no field layout and it's a mess to redefine them as elements to use Craft features... I did it once, it was not funny
  * You are not able to use Craft relations by default and have to create custom relation tables if you are going to do fancy stuff
  
  After you decided what to use, you have to decide how you would like to proceed. You can create a custom element type or use an existing one (entries, categories) and how complex it needs to be. But without more information from your site it's hard to give any further advice.
  
  I suggest everyone to create a custom plugin for imports to handle them. Due to Crafts/Yii2's plugin management and services it's totally trivial to create a data import because everything is really easy to understand and to manage. You can create a custom controller to fetch the data you need, set the values of your elements/records and use their `save` functions. The rest happens nearly automatically
  
  > **Comments:**
  > **username_0**: Do you know the performance bottleneck for elements? We will use external services for search for example but still we are planing to put over 100k record with 10-20 fields. Guess it will not to slow specially if the search will be external - fron algolia  
  > **username_1**: 100k should not be that bad. I've never tested the exact number so I can't say for sure. Does your client need to see/manipulate the imported data in the cp? If not records are totally enough  
  > **username_0**: Manipukation is needed. Need the flexibility of craft for content management. After import they will have a workflow task to make the content sexy before publising. Anyhow we will test it anyway:) but thx for the hints and links!  
  
  ---
  
  