GRRRRRR this is a major error in the manual

In book page 172

db.import_to_csv_file(form.vars.data.file,unique=False)

is supposed to be:

db.import_from_csv_file(form.vars.data.file)

only db[table].import_from_csv_file take the unique argument. not the
import of the entire DB.

You get the KeyError because you probably have auth_tables that do not
have a uuid. The example only works if you do not have auth enabled
(comment auth.define_tables())

Massimo


On Oct 5, 12:38 pm, CJSteel <chris.st...@gmail.com> wrote:
> Database Synchronization and UUID's
>
> I am wondering if I need to do searches by uuid's in a different way.
> I have been experimenting with them and frequently run into the error -> 
> KeyError: 'uuid' when attempting to do queries or when trying to
>
> pass them as variables from controllers to views and vice-versa.
>
> At the moment I am working with the example in the book (171-173) and
> seem to be getting the same error again with the book example in
> addition to one other error:
>
>     TypeError: import_from_csv_file() got an unexpected keyword
> argument 'unique'
>
> OR
>
>     KeyError: 'uuid'
>
> I can eliminate the first error by changing the following line in the
> import function:
>
>     db.import_from_csv_file(form.vars.data.file,unique=False)
>
> to be
>
>     db.import_from_csv_file(form.vars.data.file) #removed unique=False
>
> but then the now dreaded KeyError: 'uuid' shows up again. Here are
> some links to my current db.py and default.py which are basically from
> the book, although I needed to import some additional modules to get
> it working and needed to change "now" to be "request.now" :
>
> db.py
>    view          http://vishpala.com/resources/web2py/db.py/view
>    download  http://vishpala.com/resources/web2py/db.py/at_download/file
>
> default.py
>     view        http://vishpala.com/resources/web2py/default.py/view
>     downloadhttp://vishpala.com/resources/web2py/default.py/at_download/file
>
> This line in the book intrigued me but I was not sure about how to go
> about creating an index manually to make searching by uuid's go
> faster, especially since I seem to be unable to search by uuid's at
> all. I have a feeling it is a formatting issue (standard index int vs
> the uuid format which includes dashes.
>
>     "Create an index manually to make the search by uuid faster."
>
> I would appreciate any assistance and or suggestions, especially in
> regards to a functioning query search by uuid and getting the import
> function working.
>
> Web2py rocks!
>
> Cheers,
>
> Christopher Steel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to