DMS - Is it possible to write an expression to get a row as JSON?

0

I am using DMS and adding a column with a transformation rule. I want the value of that column to be the source row's contents as JSON.

Unfortunately, in the documentation it isn't clear to me what we can use from SQLite. (For example, SELECT statements throw a syntax error, but I can use some functions that are not listed in the documentation, so I don't know what I can and can't use. Also, $ must be used to access columns which is not SQLite syntax, but is not explained so I don't know if there are other syntax differences I'm not aware of.)

I managed to get close to my goal with the following expression. It outputs what I want, but I can only get this by specifying each column name. My data is dynamic, so I need a way to generate this without knowing the column names.

"expression": "json_object('id', $id, 'name', $name, 'next_column', $next_column)"

If I could use all SQLite commands I could just do .mode json and ask for the row, but it seems this is not supported. How can I accomplish this?

John
已提問 2 年前檢視次數 297 次
1 個回答
1
已接受的答案

Hello John

Thank you for reaching us. I understand that you will like to know of a possible way via which you can make use of the following expression in DMS transformation rules:

"expression": "json_object('id', $id, 'name', $name, 'next_column', $next_column)"

And I understand that the fields are dynamic in nature and there isn't a way to know the names beforehand. I did check more on these and unfortunately as you have correctly pointed out, at this point there is no mechanism to loop through the row contents to grab the field names.

If you have an active AWS Support plan I will highly encourage you to reach out to our Premium Support Team along with the use case and they will be more than happy to submit a feature request on your behalf.

AWS
支援工程師
Mano_S
已回答 2 年前
  • Too bad it's not possible, but thanks for looking into it!

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南