Thanks Massimo for the hint with the exceptions!

Anyway, I'm now back at trying to use the google bulk uploader:
I forgot that there is absolutely no code allowed on app engine that
employs file access,
this is why the imported csv.reader won't work.

(Note: I found in gluon/contrib/gql.py some lines about csv output but
I suppose that was just for testing (since it occurs in the docstring
test). I found no code for importing.)

Daniel

On Sat, Nov 22, 2008 at 23:39, mdipierro <[EMAIL PROTECTED]> wrote:
>
> models are always executed, in alphabetic order. There is nothing you
> need to do.
> The error is not generated by the code below but by a select
> somewhere.
>
> anyway rewrite your code below as
>
>> try:
>>     from google.appengine.api import urlfetch
>> except:
>>     pass
>> else:
>>     url = "http://domain/path/table_1.csv";
>>     result = urlfetch.fetch(url)
>>     if result.status_code == 200:
>>         db.table_1.import_from_csv_file(result.content)
>
> or you cannot see if it fails
>
>
>
> On Nov 22, 3:31 pm, "Daniel Contag" <[EMAIL PROTECTED]> wrote:
>> Ok,
>> I've got an idea:
>>
>> In
>> models/db.py:
>>
>> add this:
>>
>> # experimental:
>> # fill database from csv-files
>> try:
>>     from google.appengine.api import urlfetch
>>     url = "http://domain/path/table_1.csv";
>>     result = urlfetch.fetch(url)
>>     if result.status_code == 200:
>>         db.table_1.import_from_csv_file(result.content)
>>
>> except:
>>     pass
>>
>> However, I can't seem to trigger an execution of the model file on
>> google app engine.
>> I just get an error because the default view is operating on an empty SQLSet:
>>
>> "if len(tablenames)<1: raise SyntaxError, 'SQLSet: no tables selected'
>> SyntaxError: SQLSet: no tables selected"
>>
>> Any ideas to force the execution of the model file?
>>
>> Thanks!
>>
>> Daniel
>>
>> On Sat, Nov 22, 2008 at 18:56, Daniel Contag <[EMAIL PROTECTED]> wrote:
>> > Hi all,
>>
>> > does anyone have a suggestion how to use the bulk loader for Google
>> > Appengine with a web2py model?
>> >http://code.google.com/appengine/articles/bulkload.html
>>
>> > I have been testing a small app locally with sqlite3 and have deployed
>> > it to appengine. All that's missing is the data from the
>> > sqlite-database.
>>
>> > Thanks,
>>
>> > Daniel
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
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