import_from_csv_file

34 views
Skip to first unread message

goome

unread,
Jan 11, 2016, 12:07:55 PM1/11/16
to web2py-users
hi
Does import_from_csv_file only operate insert sql statement or it could also operate update record? In this case would it be enough the presence of unique column in the csv(without id) for it?
Thanks

Anthony

unread,
Jan 11, 2016, 2:25:00 PM1/11/16
to web2py-users
db.mytable.import_from_csv(..., unique='my_unique_column')

will do an update instead of an insert if the value of the "my_unique_column" field matches that of an existing record in the database.

Anthony

Marcello Console

unread,
Jan 11, 2016, 2:52:10 PM1/11/16
to web...@googlegroups.com
Thank you!!!!
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/cPq5TmjI734/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
Reply all
Reply to author
Forward
0 new messages