Skip to content

Commit

Permalink
Merge pull request #5173 from colleenkerr/develop
Browse files Browse the repository at this point in the history
Add redshift example for JSON formatting
  • Loading branch information
KellieHawks authored Mar 31, 2023
2 parents 2664d28 + ca7c639 commit ec04105
Showing 1 changed file with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ You can set it to' null' if you want to completely remove an attribute from a us
#### Create JSON string from another table

If you prefer to store each attribute in its own column internally, you need to convert those columns to a JSON string to populate the sync with Braze. To do that, you can use a query like:

{% tabs %}
{% tab Snowflake %}
```json
CREATE TABLE "EXAMPLE_USER_DATA"
(attribute_1 string,
Expand All @@ -115,8 +118,32 @@ SELECT
attribute_2,
'yet_another_attribute',
attribute_3)
)as PAYLOAD FROM "EXAMPLE_DATA";
)as PAYLOAD FROM "EXAMPLE_USER_DATA";
```
{% endtab %}
{% tab Redshift %}
```json
CREATE TABLE "EXAMPLE_USER_DATA"
(attribute_1 string,
attribute_2 string,
attribute_3 number,
my_user_id string);

SELECT
CURRENT_TIMESTAMP as UPDATED_AT,
my_user_id as EXTERNAL_ID,
SELECT JSON_SERIALIZE(
OBJECT (
'attribute_1',
attribute_1,
'attribute_2',
attribute_2,
'yet_another_attribute',
attribute_3)
) as PAYLOAD FROM "EXAMPLE_USER_DATA";
```
{% endtab %}
{% endtabs %}

#### Using the UPDATED_AT timestamp

Expand Down

0 comments on commit ec04105

Please sign in to comment.