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
feita há 2 anos297 visualizações
1 Resposta
1
Resposta aceita

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
ENGENHEIRO DE SUPORTE
Mano_S
respondido há 2 anos
  • Too bad it's not possible, but thanks for looking into it!

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas