0

For example, say I wanted to have one column take the row id and run it through a Python script which returns some information related to that number (random example).

Would I need to manually populate the database with this information, or is there some mechanism to do this from within the database?

1
  • Did you consider PL/Python?
    – kupson
    Feb 11, 2012 at 11:53

1 Answer 1

0

PL/Python seems like the obvious choice. Here's a little quick tutorial to get you started. This is useful for situations where you need the database to automatically perform some operation (e.g. trigger), or from a stored procedure and your language of choice is python.

However, if it's just a one-off operation to go over all data and update something, it's probably better to write this outside the database in a script and just run it against the database. Generally speaking, maintaining your code outside the database itself is better. You can more easily version-control it, run tests against it and update it as necessary. That of course depends on many factors so it's more a question of preference than something definitive. PL/Python wouldn't exist if it didn't have a legitimate use-case (and obviously it does).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .