About EasyMorph Tutorials & Examples Web-help

Database command question

Hi there,

I use the Database commands a lot.
Would it somehow be possible to automatically generate tables based on the EM table that you are using?
Right now, if I iterate through a list of DB tables, and I want to use the database command, it doesn’t pick up the table columns automatically per iteration. It would only use the table columns that you initially set.

It’s also an issue when you pick up data from an API endpoint, and the API columns have been changed. How to automatically pick up that new column (assuming I do a drop and create table each time)?

I hope my challenge is clear and you might have some suggestions.

1 Like

I would suggest generating a custom SQL statement CREATE TABLE ... with the necessary columns and data types, and executing it with the “Database command” action, command “Custom SQL”. This may require putting the action into a separate module in order to pass it the generated statement.

When you parse the API response (JSON or XML) you get a table. You can get a list of columns in that table using the “Table metadata” action. Then create a custom SQL statement as described above.

1 Like

Hi Dmitry,
Thanks for your answer! I was too much focuessed on a solution within the functions (actions) of Easymorph but this is off course a good idea. I need to improve my SQL skills :slight_smile:

You’re welcome :slight_smile:

To learn more about EasyMorph visit easymorph.com.