On Tue, Aug 13, 2013 at 8:55 PM, Steven Brown <[email protected]> wrote:
> db = web.database(dbn='postgres', user='MES', pw='MES', db='prestigeDB')
>
> Here is the sql query:
>
> entry = db.insert('entries',
> url = formInstantiation['prestigeLink'].value,
> file_uploaded = fileUploaded,
>
> prestige_amount =
> int(formInstantiation['prestigeAmount'].value),
> prestige_type = db.query('SELECT prestige_type FROM awards
> WHERE award_id = ' + formInstantiation['prestigeAward'].value) if
> formInstantiation['prestigeType'].value=='blank' else
> formInstantiation['prestigeType'].value,
> prestige_amount2= 0 if
> formInstantiation['prestigeAmount'].value == '' else
> int(formInstantiation['prestigeAmount'].value),
> prestige_type2 = formInstantiation['prestigeType2'].value,
>
> prestige_month =
> int(formInstantiation['prestigeMonth'].value),
> award_id =
> int(formInstantiation['prestigeAward'].value),
>
> member_id = int(memberID),
> comments = formInstantiation['prestigeComments'].value,
> time_submitted = getHomeOrgunitTime(memberID)
> )
> print 'type(entry):'
> print type(entry)
>
> The last two lines produce:
> type(entry):
> <type 'NoneType'>
>
> The insert works fine; it puts all the information into the database just
> fine.
>
Ok, it work only when the name of the serial column is "id". Otherwise
you'll have to specify the seqname.
If name of your serial column is entry_id, then:
entry = db.insert('entries', seqname='entries_entry_id_seq', ...)
By default, it cheks if seqname table+"id_seq" exists, if so it uses that,
if not it just returns None.
Anand
--
You received this message because you are subscribed to the Google Groups
"web.py" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/webpy.
For more options, visit https://groups.google.com/groups/opt_out.