Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
Did you consider PL/Python? – kupson Feb 11 '12 at 11:53

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).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.