Insert record in foreign DB

24 views
Skip to first unread message

Gael Princivalle

unread,
May 25, 2015, 8:21:21 AM5/25/15
to web...@googlegroups.com
Hello all.

I use a PHP opensource application called PHPList for newsletter management.
It use a Mysql db that we can call 'phplistdb'.
User table is 'phplist_user_user'.

I would like to add a user in 'phplistdb' from web2py.

If I try something like that:
def insert_phplist_user():
    email
= 'te...@test.it'
    last_id
= dbphplist.phplist_user_user.insert(email=email, confirmed = 1, blacklisted = 0, optedin = 0, bouncecount = 0, htmlemail = 1, disabled = 0)
   
return dict()

Ticket is:
'DAL' object has no attribute 'phplist_user_user'

I could imagine that's due to the fact that table 'phplist_user_user' has not been defined in web2py.

What's the solution, defining in web2py the table  'phplist_user_user'?
I hope it'll don't crash the db for the 'phplist' application.

Thanks.

Niphlod

unread,
May 25, 2015, 11:40:08 AM5/25/15
to web...@googlegroups.com
just define it with migrate=False and web2py won't issue any ddl statement.

Gael Princivalle

unread,
May 28, 2015, 6:33:45 AM5/28/15
to web...@googlegroups.com
Thanks Niphlod, it resolve the error.
Reply all
Reply to author
Forward
0 new messages