Cannot delete entity with broken id from datastore - google-app-engine

I managed to create an entity in the datastore with the following key: 'mydomainname.se-w3wp--ap-mydomainname.se--v-v2.0--l-webengine4.dll--a-%2F.pipeiisipm9d20c68a-5b24-4161-aa53-a8dd9e44f002--h-C%3Ainetpubempapppoolssmydomainname.semydomainname.se.config--w---m-0--t-20'
It shows up when I list the entities in my application, but I cant find it in the datastore viewer so I can't delete it. Any suggestions on how to get rid of it?
I'm using Python.

I can't tell if you're using python or java.
With python you can use the Remote API shell to query your entity and delete it.
Java's got a remote API as well, but you'll have to write a bit more code to create the client that will run your query and delete the entity.

Related

Memcache viewer in new GAE console

I'm trying to delete a key from the memcache using the latest GAE console (https://console.developers.google.com/appengine/memcache). I used to be able to do this with the old console but I can't figure out the new one.
Sometimes I manually edit an entity with the GAE console and afterwards I need to delete the entity from the memcache so that my app uses the latest data. I know the entity is in the memcache since the old data is being served, but I can't find it with the memcache viewer.
Here is the new memcache console:
I leave Namespace blank because I don't use them.
I select Python String for the key type since I am using Python.
For the key, I've tried:
Key('Election', 6254893018906624)
aglzfm9wYXZvdGVyFQsSCEVsZWN0aW9uGICAgKSsmY4LDA
NDB9:aglzfm9wYXZvdGVyFQsSCEVsZWN0aW9uGICAgKSsmY4LDA
but none of them work.
Clicking the "Show all keys" link just produces a blank screen.
How do I get this to work?
Not sure for Python, but for Java, with Objectify, I have used this many times:
Namespace: ObjectifyCache
Key type: Java String
Key: aglzfm9wYXZvdGVyFQsSCEVsZWN0aW9uGICAgKSsmY4LDA (from your data)

Liferay document checkin issue

I'm still new to Liferay and using Liferay 6.2
what i'm doing:
I am trying to add a document manually into my database using insert statement.
I inserted into dlfileentry, dlfileversion and AssertEntry.
Also, i created a folder with the valid name and file.
The issue:
upon entering the Documents and Media portlet, i can see the document name there but when i click on checkout, it will prompt a error saying that Documents and Media is temporarily unavailable. however i am still able to download the valid document.
Am i doing something wrong? Personally, i feel that i am missing one more table for the database but i'm not sure .
Thanks!
Yes, you're doing something wrong: You should never write to Liferay's database with SQL, as there might be more data required than what's directly visible to you. Obviously, you're running into exactly such an issue.
Liferay has an API which you can use locally, from within the same application server, or remotely as JSON or SOAP service. You should exclusively use this for write access to the database.
Alternatively, you might consider WebDAV access to your document repository as the way to add more documents to the document library.

Manually add entity to empty Google App Engine DataStore

From the tutorial, which I confirmed by creating a simple project, the index.yaml file is auto-generated when a query is run. What I further observe is that until then the admin console (http://localhost:8080/_ah/admin/datastore) does not show the data-store.
My problem is this: I have a project for which data/entities are to be added manually through the datastore admin console. The website is only used to display/retrieve data, not to add data to the data-store.
How do I get my data-store to appear on the console so I can add data?
Yes, try retrieving from the empty data-store through the browser just so I can get the index.yaml to populate, etc. But that does not work.
The easiest way is probably just to create a small python script inside your project folder and create your entities in script. Assign it to a URL handler that you'll use once, then disable.
You can even do it from the python shell. It's very useful for debugging, but you'll need to set it up once.
http://alex.cloudware.it/2012/02/your-app-engine-app-in-python-shell.html
In order to do the same on production, use the remote_api:
https://developers.google.com/appengine/articles/remote_api
This is a very strange question.
The automatic creation of index.yaml only happens locally, and is simply to help you create that file and upload it to AppEngine. There is no automatic creation or update of that file once it's on the server: and as the documentation explains, no queries can be run unless the relevant index already exists in index.yaml.
Since you need indexes to run queries, you must create that file locally - either manually, or by running the relevant queries against your development datastore - then upload it along with your app.
However, this has nothing at all to do with whether the datastore viewer appears in the admin. Online, it will always show, but only entity kinds that actually have an instance in the store will be shown. The datastore viewer knows nothing about your models, it only knows about kinds that exist in the datastore.
On your development server you can use the interactive console to create/instantiate/save an entity, which should cause the entity class to appear in the datastore interface, like so:
from google.appengine.ext import ndb
class YourEntityModel(ndb.Model):
pass
YourEntityModel().put()

Search support for Google App Engine Go runtime

There is search support (experimental) for python and Java, and eventually Go also may supported. Till then, how can I do minimal search on my records?
Through the mailing list, I got an idea about proxying the search request to a python backend. I am still evaluating GAE, and not used backends yet. To setup the search with a python backed, do I have to send all the request (from Go) to data store through this backend? How practical is it, and disadvantages? Any tutorial on this.
thanks.
You could make a RESTful Python app that with a few handlers and your Go app would make urlfetches to the Python app. Then you can run the Python app as either a backend or a frontend (with a different version than your Go app). The first handler would receive a key as input, would fetch that entity from the datastore, and then would store the relevant info in the search index. The second handler would receive a query, do a search against the index, and return the results. You would need a handler for removing documents from the search index and any other operations you want.
Instead of the first handler receiving a key and fetching from the datastore you could also just send it the entity data in the fetch.
You could also use a service like IndexDen for now (especially if you don't have many entities to index):
http://indexden.com/
When making urlfetches keep in mind the quotas currently apply even when requesting URLs from your own app. There are two issues in the tracker requesting to have these quotas removed/increased when communicating with your own apps but there is no guarantee that will happen. See here:
http://code.google.com/p/googleappengine/issues/detail?id=8051
http://code.google.com/p/googleappengine/issues/detail?id=8052
There is full text search coming for the Go runtime very very very soon.

What is a proper way to initialize data store for static data in Google App Engine?

I have a model called "Category" in my app in GAE.
This model simply contains a name and it's parent category, and this won't be changed frequently after the website go online.
I'd like to know what is a better way to put these model instances in the beginning?
I now only know to execute (category.put()) in a webapp.RequestHandler by issuing a http request. But I suspect there is a proper way to do this.
Thanks!
You can use the remote API to connect to your datastore in a shell and add data as required.
Or, if it's a huge amount, you could think about using the bulk loader - but I suspect that the remote API will be more suitable.

Resources