You might look at using generated columns for this.
I have a project that routinely is ingesting data from remote api’s and rather than pick and choose what I store, I now simply store the entire json in a single column in the database and then create generated columns that pick and choose the data I need. Among other things, I like it because I have access to all the data, so if the business needs change in the future, I can simply modify the generated columns, or add new ones without having to reimport.
Perhaps if you don’t have to spin through each record, you will get to a reasonable level of performance.
I haven’t looked at your specific mapping, but I would venture to say you’d be able to map within the db generated columns.
@mebeingken, I understand correctly that you store each json response in a separate cell in a separate table. And then with a SQL query parse this cell and save the data to a new table?
I store the Jason in a single field, and then create additional columns that automatically extract data points from the json. These generated columns are not updated directly via sql inserts and updates, but rather they reflect data that exists in other columns of the same row.
You could probably do it with a repeater etc., but with this kind of custom transformation I would suggest to create a custom action. What is the server model (ASP/PHP/Node) that you need it for?
What did you pass as the data? My sample code would accept the data array with the dimensions and metrics object as option. I think in your case {{yandex_metrika_check_test.data.data}}.
Patrick, thank you! The module works correctly and is very fast compared to the loop.
The only thing is, there is an error in your code, you need to put “data” before “metrics”.
@patrick , can you tell me how to change the module so that it takes the key names from the “query” object and is not tied to a clear sequence and number of values? I just have situations where the set of measurements will be different.