Is that CSV import impossible because web2py can't set a primary key
that is not id ?
Not even possible with your sqldesigner :
http://mdp.cti.depaul.edu/sqldesigner/default/sqldesigner

I don't have any trouble importing my CSV into an sqlite database made
with the firefox extension (SQLite Manager) and with my first field
"nom" set as text and primary key.
If I try with a db where the primary key is id, it's impossible to do
the import.
Trying with an db made with web2py an open with SQLite Manager too,
import impossible.

++ fredg


On 8 avr, 11:35, fredg <[email protected]> wrote:
> On 7 avr, 21:34, mdipierro <[email protected]> wrote:> Because if 
> appadmin were to give a ticket people would interpret this
> > as a web2py (appamdin) bug.
>
> Yes, I understand.
>
> >    db.youtable.import_from_csv_file(open(....,'rb'))
>
> <code>
> fredg [ ~/Desktop/web2py ]$ python web2py.py -S nutyx
> WARNING:root:unable to import dbhash
> default applications appear to be installed already
> web2py Enterprise Web Framework
> Created by Massimo Di Pierro, Copyright 2007-2009
> Version 1.59 (2009-03-16 13:10:16)
> Database drivers available: SQLite3
> WARNING:root:import IPython error, use default python shell
> Python 2.5.4 (r254:67916, Dec 30 2008, 15:35:29)
> [GCC 4.3.2] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> (InteractiveConsole)>>> 
> db.packages.import_from_csv_file(open('/tmp/db_packages.csv','rb'))
>
> Traceback (most recent call last):
>   File "<console>", line 1, in <module>
> NameError: name 'db' is not defined
> </code>
>
> I have try to add packages by hand through your web2py admin interface
> in my database created by :
> <code>
> #!/usr/bin/python
> # -*- coding: utf-8 -*-
> db = SQLDB('sqlite://packages.db')
> ## Table des Packages
> db.define_table("packages",
>     SQLField("nom","text",length=32,default=""),
>     SQLField("description","text",length=128,default=""),
>     SQLField("url","text",length=64,default=""),
>     SQLField("packager","text",length=64,default=""),
>     SQLField("categorie","text",length=32,default=""))
> </code>
>
> And it works like a charm, here is the export CSV file (with special
> characters ;) )
> <code>
> packages.id,packages.nom,packages.description,packages.url,packages.packager,packages.categorie
>
> 1,b43-cutter,plop plip (po),http://www.plop.org/~down4/plop,thierryn1
> at plop dot com,cat
>
> 2,tpokoij-iuhuhh32,kjihiy y_y_yy-tèuggôih,http://www.plop.pop,,cat
>
> 3,blah-blah-2,"ihyszui, yh_y_yi-zu34ih jôîuh 
> hyuhy",http://www.plop.plop/~ljij/123,fredgat web2py dot org,cat
> </code>
>
> Hope it helps.
>
> ++ fredg
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to