Q: How to automatically migrate seed data file contents into PDM using scripting?

Skip to first unread message

Mark Renier

Apr 27, 2010, 10:17:12 AM4/27/10
In my PDM, for certain tables, I have "after scripts" that insert rows
data into the corresponding table at generation time. This works
great, as I can push out seed data with the data model just before
generating the target schema by manually copying-and-pasting the file

Now, I would like to move these seed data scripts out of the model and
into Subversion (SVN), so that others can update the seed data. I drop
a file object on the PDM diagram, then edit its properties by
unchecking GENERATE, checking ARTIFACT, and setting it's external
location to my local SVN repository location of the desired seed data
script file (*.sql).

I would like to create some script that automatically identifies those
extended dependencies (from table to file) and then automatically
replaces the SCRIPT AFTER tab contents with the contents in the target
file. I can use a specific stereotype SEEDDATA to identify the

I know PowerDesigner has the capabilities to automate this, but I need
some help to push me onto the right track. I have not yet done any
scripting inside PowerDesigner to begin this task. Any help is
appreciated, thanks.



Apr 28, 2010, 3:09:29 PM4/28/10
Brilliant! We use after scripts for that all the time, and I'm
ashamed we never thought of this. Should have an answer for you by
the end of the day. I've got most of the pieces available from other
work and I've got projects that can use this immediately.


Apr 28, 2010, 11:23:44 PM4/28/10
I put together an extended model definition that handles this, I'm
sure there will be a few rough spots. I put a description of how I
did it here http://rkkier.wordpress.com/2010/04/28/adding-seed-data-to-the-after-tab/

There's a download link at the bottom where you can download a sample
file. Let me know if you run into any problems, this was my first
attempt at including a download link. Please share any improvements
you come up with.

Reply all
Reply to author
0 new messages