Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Dynamic table name for RDBMS?

Avatar

Avatar
Level 1
travistravis
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
travistravis
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
View profile
travistravis
Level 1

25-10-2017

This is in Campaign 6.1.

I'm having some trouble getting this to work. We're trying to set up a system to pull a specific set of customers each day from a PostreSQL database we have set up as RDBMS. This works fine for regular deliveries and campaigns, but this time we want to be able to dynamically generate the name of the table. (Basically they will be along the lines of 'call_back_2017_10_25' with the date changing each day.

I've managed to put javascript into the initialization that can get me the table name I want - but am at a loss for where to assign the database to actually use it. (I've tried a few things.)


When I assign the table name as normal in the GUI and pull the XML for each the failed and non-failing it seems that the bad one is not getting the connection.  The error I get is as follows (some stuff redacted)

25/10/2017 14:01:47 dbImport PostgreSQL error: ERROR:  syntax error at or near ")" LINE 1: COPY wkf295681483_55_1 () FROM STDIN                                 ^

25/10/2017 14:01:47 dbImport Starting 1 connection(s) on pool 'nms:extAccount:153296623 ****' (PostgreSQL, server='*******', login='******')

25/10/2017 14:01:47 dbImport Loading data from table 'happy_birthday_v2' (step 'Data loading (RDBMS)')

I know there's a lot we should fix (like using FDA and updating our server), but I'm willing to bet this is just down to me not understanding how all the bits connect, this is my first foray into attempting scripts in initialization (or at all.) Can anyone see anything obvious I would have missed?

Replies

Avatar

Avatar
Level 1
travistravis
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
travistravis
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
View profile
travistravis
Level 1

26-10-2017

As a followup:Screen Shot 2017-10-26 at 11.02.28.png

I deleted this activity and re-added it (since it was missing part of the activity, I thought maybe that would help). Upon creating as normal and setting things up for a normal data loading, I added an initialization script that dynamically pulled the name of another table. It did load this table correctly.

HOWEVER. On a second run of this workflow (since it will be ran repeatedly using a scheduler), it fails. It is fixed if I hit the above button "Update Schema Structure". But I can't tell what this button does, or how I can trigger this behaviour from inside a script. (I can do it after creating the table name - but don't know what it does.)

Avatar

Avatar
Give Back 50
Level 10
florentlb
Level 10

Likes

237 likes

Total Posts

1,109 posts

Correct Reply

239 solutions
Top badges earned
Give Back 50
Give Back 5
Give Back 3
Give Back 25
Give Back 200
View profile

Avatar
Give Back 50
Level 10
florentlb
Level 10

Likes

237 likes

Total Posts

1,109 posts

Correct Reply

239 solutions
Top badges earned
Give Back 50
Give Back 5
Give Back 3
Give Back 25
Give Back 200
View profile
florentlb
Level 10

06-11-2017

Hi Travis,

Can you share some more screenshots of your workflow so we can get a better overview of your process here? In which activity did you set the initialization script?

Florent

Avatar

Avatar
Give Back 50
Level 10
florentlb
Level 10

Likes

237 likes

Total Posts

1,109 posts

Correct Reply

239 solutions
Top badges earned
Give Back 50
Give Back 5
Give Back 3
Give Back 25
Give Back 200
View profile

Avatar
Give Back 50
Level 10
florentlb
Level 10

Likes

237 likes

Total Posts

1,109 posts

Correct Reply

239 solutions
Top badges earned
Give Back 50
Give Back 5
Give Back 3
Give Back 25
Give Back 200
View profile
florentlb
Level 10

30-11-2017

Hi Travis,

Any update to share on this topic?

Florent