0

I'm trying to import my csv file into the appengine datastore, and don't get any errors, but where are the entities? I could not see it in my appengine console in the datastore section.

models.py:

from google.appengine.ext import db

class Glyph(db.Model):
    glyphId = db.IntegerProperty(indexed=True)
    pageNumber = db.IntegerProperty()
    lineNumber = db.IntegerProperty()
    position = db.IntegerProperty()
    min_x = db.IntegerProperty()
    max_x = db.IntegerProperty()
    min_y = db.IntegerProperty()
    max_y = db.IntegerProperty()
    resolution = db.IntegerProperty()

bulkloader.yaml:

python_preamble:
- import: google.appengine.ext.bulkload.transform
- import: google.appengine.ext.bulkload.bulkloader_wizard
- import: google.appengine.ext.db
- import: google.appengine.api.datastore

transformers:
- kind: Glyph
  connector: csv
  connector_options:
    encoding: utf-8
    columns: from_header
  property_map:
  - property: glyph_id
    external_name: glyph_id

  - property: page_number
    external_name: page_number

  - property: line_number
    external_name: line_number

  - property: position
    external_name: position

  - property: min_x
    external_name: min_x

  - property: max_x
    external_name: max_x

  - property: min_y
    external_name: min_y

  - property: max_y
    external_name: max_y

  - property: resolution
    external_name: resolution

glyphs.csv:

glyph_id,page_number,line_number,position,min_x,max_x,min_y,max_y,resolution
211,1,2,1,188,217,43,58,320


Environment: cygwin
Appengine version: 1.9.6
$ appcfg.py upload_data --config_file=bulkloader.yaml --filename=glyphs.csv --kind Glyph --url=http://webservice.appspot.com/_ah/remote_api --email=email@gmail.com --batch_size=1000 --rps_limit=500

Thanks in advance.

12:04 PM Uploading data records.
[INFO    ] Logging to bulkloader-log-20140704.120441
[INFO    ] Throttling transfers:
[INFO    ] Bandwidth: 250000 bytes/second
[INFO    ] HTTP connections: 8/second
[INFO    ] Entities inserted/fetched/modified: 500/second
[INFO    ] Batch Size: 1000
[INFO    ] Opening database: bulkloader-progress-20140704.120441.sql3
[INFO    ] Connecting to webservice.appspot.com/_ah/remote_api
[INFO    ] Starting import; maximum 1000 entities per post
.........................................................................................
[INFO    ] 88246 entities total, 0 previously transferred
[INFO    ] 88246 entities (85210 bytes) transferred in 14.2 seconds
[INFO    ] All entities successfully transferred

log file:

[DEBUG    2014-07-04 18:41:21,390 adaptive_thread_pool.py] Waiting for Anonymous_WorkerThread to exit
[DEBUG    2014-07-04 18:41:21,390 bulkloader.py] Waiting for progress_thread to terminate...
[DEBUG    2014-07-04 18:41:21,453 bulkloader.py] [Thread-11] ProgressTrackerThread: exiting
[DEBUG    2014-07-04 18:41:21,468 bulkloader.py] ... done.
[INFO     2014-07-04 18:41:21,468 bulkloader.py] 88246 entities total, 0 previously transferred
[INFO     2014-07-04 18:41:21,468 bulkloader.py] 88246 entities (85210 bytes) transferred in 16.2 seconds
[INFO     2014-07-04 18:41:21,468 bulkloader.py] All entities successfully transferred

console log:

2014-07-06 17:07:44.290 /_ah/remote_api 200 19ms 0kb Google-remote_api/1.0 CYGWIN_NT-5.1/1.7.30(0.272/5/3) Python/2.7.3.final.0 gzip module=default version=1
69.247.153.191 - admin [06/Jul/2014:17:07:44 -0700] "POST /_ah/remote_api HTTP/1.1" 200 92 - "Google-remote_api/1.0 CYGWIN_NT-5.1/1.7.30(0.272/5/3) Python/2.7.3.final.0 gzip" "webservice.appspot.com" ms=19 cpu_ms=0 cpm_usd=0.000010 app_engine_release=1.9.6 trace_id=15aab71128af2f7dbbd629ef8fe24297 instance=00c61b117cc1848cde8da4b66f619fbabd1234

Solution: It turns out that I'm missing columns in my property_map section of my bulkloader.yaml. Fixing the mapping solved the issue.

2 Answers2

1

It turns out that I'm missing columns in my property_map section of my bulkloader.yaml. Fixing the mapping solved the issue. Solution added to the original posting.

0

The data are put into your models, as defined in your bulkloader.yaml. To see them quickly, go to your developer console, to Datastore Viewer:

https://appengine.google.com/datastore/explorer?&app_id=s~yourappid

You can use the pulldown menu to go from model to model. In your case, you only uploaded Glyphs, so look there.

GAEfan
  • 11,244
  • 2
  • 17
  • 33
  • Thanks @GAEfan. I already did, it doesn't show anything. "Oops! We couldn't retrieve your list of Kinds. Please try again later." Queries to __namespace__ are empty as well. Do I need to create one entity via the console in order to import the data? – user3802804 Jul 06 '14 at 21:07
  • Do you have a `models.py`, with the Kind `Glyph` defined? – GAEfan Jul 06 '14 at 22:14
  • Yes I do. models.py: from google.appengine.ext import db class Glyph(db.Model): glyphId = db.IntegerProperty() pageNumber = db.IntegerProperty() lineNumber = db.IntegerProperty() position = db.IntegerProperty() min_x = db.IntegerProperty() max_x = db.IntegerProperty() min_y = db.IntegerProperty() max_y = db.IntegerProperty() resolution = db.IntegerProperty() – user3802804 Jul 06 '14 at 23:03
  • Is your app id "webservice"? That is where they are uploaded. And your glyphs.csv is not a csv file, so not sure how it uploaded 18k items without an error. You should try adding the `--application=s~yourappname` flag to the appcfg.py command – GAEfan Jul 06 '14 at 23:56
  • Fixed the csv file and replaced all "|" to "," but entities still doesn't show up. I tried added --applicaton=s~webservice, but I'm getting exceptions when executing the upload_data command: [INFO 2014-07-04 18:40:10,687 bulkloader.py] Connecting to webservice.appspot.com/_ah/remote_api [ERROR 2014-07-04 18:40:10,687 bulkloader.py] Exception during authentication URLError: [ERROR 2014-07-04 18:40:10,687 bulkloader.py] Authentication Failed: Incorrect credentials or unsupported authentication t ype (e.g. OpenId). – user3802804 Jul 07 '14 at 00:16
  • it should ask you for your admin's email address and password. Those are what failed. Try adding the `--oauth2` flag to the appcfg.py command. – GAEfan Jul 07 '14 at 02:32
  • It turns out that I'm missing columns in my property_map section of my bulkloader.yaml. The datastore API silently ignore the issues. Fixing the mapping solved the issue. Thanks GAEfan for suggesting solution and fixing my csv file issue. – user3802804 Jul 07 '14 at 12:53