hi,
It's straightforward to read csv-formatted data. For example, if your csv
files are in a 'data' subdirectory of your project, you can do something
like this:
import csv
datafile = os.path.join('data', YOUR_FILENAME)
reader = csv.DictReader(
open(datafile, 'r'),
...)
etc. (see the csv module's documentation).
However, if you hava a lot of data, or need to parse it often, you might
also consider using the bulkloader tool, which lets you upload new
datastore entities from CSV files.
https://developers.google.com/appengine/docs/python/tools/uploadingdata
On 15 July 2012 14:11, McArk <[email protected]> wrote:
> Hi,
>
> First, I'm new to python & GAE so sorry if this questions sounds simple.
>
> I have a little desktop app, which answer user queries. The answers to the
> queries are based of a CSV file. My intention is to have users querying the
> system online.
> There are NO writes to these data source, just reads.
>
> The CSV looks like that:
>
> A, 1,2,3
> B, 2,3
> C, 5,6,7,8,9
> D, 1.
> etc...
>
> One thing to keep in mind is that every row has it own number of elements
> (and we are talking about 100s of elements in each row).
> This is the flow of the desktop program:
> -----
> 1. load the CSV file into OBJ
> 2. while user input
> 2.1 query OBJ
> 2.2 write response
> -----
>
> I'm using Google guest book tutorial
> <https://developers.google.com/appengine/docs/python/gettingstarted/>and
> would like to:
> - Load the data into OBJ which will be a "static" (static - java meaning,
> not sure what the python equivalent lingo) parameter
> Then I will use OBJ as part of a webapp.RequestHandler
>
> What is the best way to do it?
>
> Good advice will be appreciated!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-appengine/-/wYNKl_0UYosJ.
> 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/google-appengine?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" 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/google-appengine?hl=en.