On Wednesday, October 14, 2015 at 11:57:30 AM UTC-7, Richard wrote:
>
> if db(db.table.id > 0).count() == 0:
> db.table2.import_from_csv_file(open(open('mycsv','r'))
>
> So it will be executed only once...
>
> Richard
>
You type too fast!
/dps
>
> On Wed, Oct 14, 2015 at 10:48 AM, Prasad M <[email protected]
> <javascript:>> wrote:
>
>> I am trying to import data from csv in web2py's SQlite databae.
>> 1) First I have defined table in database.
>> 2) I wrote db.table2.import_from_csv_file(open(open('mycsv','r')) this
>> line .
>> Both steps are in Model.
>>
>> But while displaying data from the same table I am getting repeated rows
>> at each refresh of the page. It means each time file appends data to table.
>>
>> So my question is how to solve this issue?
>> Exactly where to write code for import data from csv to table? This is my
>> query.
>> I am trying to get this from 2 days.
>> Please try to answer.
>> Thank you in advanced !!!!
>>
>> --
>> 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 the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
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 the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.