142
Views
4
Comments
Solved
Migrating Data from OutSystems to an external database

Hello,

I am a relatively new user to OutSystems and would like to ask for advise. 

I am required to move all the data from 3 tables from the database in OutSystems to an external SQL database. I've done the following steps:

1. Created an extension and integrated it with the external database
2. Created a timer and server action to move the data into the SQL database. 

I managed to successfully move all the data in the first two tables (less than 50 records), but I realise that it is not working with the third table which holds a far more number of records than the first two tables. 

I tried searching up if there is a maximum limit for Lists or Aggregates, but I didn't find anything about it. If I changed the maximum number of rows in the Aggregate from None to 1 ~ 20 or some number, it works, but I'm not sure how many records there are in the table. Does anyone have a better way to go about this?

Solution

Hello Joyce.

If you are doing it in a timer, the default time limit is 20 minutes so you shouldn't have issues.

Because you aren't setting MaxRecords, the entire table is fetched at once and apparently it is too much.

What you need is to process it in batches.

The best practices video explains how to do a perfect timer:

https://www.outsystems.com/training/lesson/1133/master-class-on-best-practices-and-timers

The full video is over two hours, but here are the minimum rules for you:


  • Set a new Boolean attribute to  mark the records as sent. If you can´t, a new entity or Site Property to save the last Id sent.
  • Order your Get by Id and exclude sent records (or filter Record.Id>LastIdSent).
  • Process less records each time. Like 500.
  • Mark each of them as sent (or save the id of the last one).
  • If there are more records, wake the timer again and end this instance.


The full list of best practices also uses Commit to ensure you don't repeat work in case of failure, optimizes executions of timers based on remaining time, and has a "kill switch". But this is the bare minimum you need now.

Hello Nuno, 

I managed to get this implemented and it works wonderfully. Thank you!

Hello Joyce and Nuno, 
Please can you explain the steps you took to migrate outsystems DB to an external DB?


  Hi Joyce, glad to see you've solved it, if you in the future encounter a more complex Export situation, you can also look into our Forge component Data Migration Manager (DMM) -  https://www.outsystems.com/forge/component-reviews/2812

  There's feature to Export to External Database, that allows you to select the external tables names for each entity (or let DMM automatically select those), and DMM will create and maintain in the destination each table and column as needed, as well as in subsequent repeated exports see what records were previously exported and update them (instead of re-exporting them). You can also schedule the export executions through OutSystems timers or external API calls.

  The component is subscription based (paid), but installing from the Forge you get 5 free executions  (up to 4 entities/tables for each execution, 1GB maximum per execution) until it asks for a valid subscription license. Trial licenses (with unlimited executions) are also available upon request.


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.