newUser = Users.new(USERNAME = 'drew', PASSWORD = 'foo', CREATED = SYSDATE, LAST_MOD = SYSDATE)
The new method inserts a new row into the table. There is an optional parameter, refetch which effectively calls the refresh method (described below). This is useful in the case where you have a table with default values for columns and you want to make references to the values with the defaults in place.
What this will do is: fetch a new OID from USERS_OID_SEQ since OID wasn't specified above, and subsequently insert a new row into the USERS table with the OID and the values specified in the call to new().
As you will notice, SYSDATE is a variable that translates to the databases' idea of the current date (and time).
Now that we have a Users instance, we can examine it a bit more closely. PyDO subclass instances observe the python dictionary interface.
For example:
>>> newUser['USERNAME'] 'drew' >>> newUser['OID'] 1 >>> newUser.keys() ('OID', 'USERNAME', 'PASSWORD', 'CREATED', 'LAST_MOD')