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!

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ