Questions tagged [app-engine-ndb]
NDB is a better datastore API for the Google App Engine Python runtime. It provides an improved interface over ext.db, and includes support for parallel processing with coroutines.
1,288
questions
0
votes
1
answer
68
views
GAE and IAP: frontend and backend in two containers?
I understand that both FE and BE can be run in the same container, placing one process in the background. This ways CORS issues are resolved and Identity Access Proxy is only called once when the app ...
0
votes
2
answers
76
views
Why am I experiencing an intermittent Assertion Error for entities that are created by Cloud NDB when querying from Python2 NDB?
I recently migrated to Cloud NDB and python3 for app engine from Python2 / ndb. I need both versions running at the same time on the same Datastore.
I've found entity.get() for an entity that was ...
1
vote
3
answers
310
views
Devappserver: Attempted RPC call without active security ticket
We're in the migration process from webapp2 to the latest version of Django. We want to keep using legacy services like Appengine NDB for now before we move to the latest technologies.
For running the ...
0
votes
0
answers
25
views
Can the User model be replaced by a Google NDB model in Django?
Usually when we create the the User model by inheriting AbstractUser which is eventually inherited from django.db.models.Model. e.g.
from django.contrib.auth.models import AbstractUser
class User(...
0
votes
1
answer
57
views
Why does dev_appserver.py exit without throwing errors?
I am trying to run a simple python 2 server code with AppEngine and Datastore. When I run dev_appserver.py app.yaml, the program immediately exits (without an error) after the following outputs:
/home/...
0
votes
2
answers
56
views
GCP Datastore NDB: Filter for KindA elements keys that are NOT IN KindB documentId
Here is my situation: I have two Datastore kind, I need to create a python query for all Data that don't are present in Kind B. In the sample those are: Data 3 and Data 4.
The constraint here is that ...
0
votes
2
answers
81
views
Python3 dev_appserver and datastore
I am creating a small Python 3 app for appengine, and I'd expect this to use the local datastore (which to the best of my understanding is a .db file).
I am starting the app using dev_appserver.py ., ...
0
votes
1
answer
100
views
maximum recursion depth exceeded appears when google ndb tasklet tries to update the data
I was joined to project with a lot of changes frequency, developments have already been done in the project and it has looked like a monolith architecture! sometimes we are using some fields at the ...
0
votes
1
answer
105
views
Store details of Blobkey for images stored in google cloud storage
I am trying to migrate an application from the google app engine standard environment first generation(python 2.7 runtimes) to second-generation ( python 3 runtimes).
The application serves the user-...
0
votes
1
answer
74
views
Rollback in NDB
I am trying to maintain some cross transactional-ity between different services.
Basically I have a ndb model which would be processed. There is a chance that the transaction might fail after we have ...
0
votes
1
answer
78
views
Query on children table and order result of a query by parent's fields at NDB
At my model, I have two tables like the ones below that are related:
from google.appengine.ext import ndb
class Parent(ndb.Model):
name = ndb.StringProperty()
class Child(ndb.Model):
parent =...
0
votes
1
answer
51
views
How to call classmethod of base class from derived class when base class itself is inheriting from another library class (ndb.Model)
I know questions related to classmethods in python have been answered many times, but even after implementing those solutions, the problem I'm facing still persists.
I came across many answers which ...
0
votes
1
answer
53
views
GCP datastore sudden extreme data inconsistency (NDB 1.8.0)
I have 6 months old Py38 standard gae project in europe-west3 region along with Firestore in DATASTORE mode.
Even with Redis as global cache or without, I have never had any inconsistency issues. ...
0
votes
1
answer
38
views
How to solve google cloud ndb data disappear when store at the same time?
In my app ,if two users answer the same question at the same time from two different browsers, the first answer was disappeared and the last answer was saved. How can I solve that problem?
User One ---...
0
votes
1
answer
94
views
How to find out whether default value is used for Datastore ndb property?
Let's say we have a model like this:
class UserConfig(ndb.Model):
name = ndb.StringProperty()
email_subscriber = ndb.BooleanProperty(default=True)
Let's assume email_subscriber was set to ...
0
votes
1
answer
24
views
Does `fetch_page()` just not guarantee a minimum amount of results when used with `filter()`?
In the documentation we have:
page_size: At most this many results will be returned.
It looks like when using filter along with fetch_page, it doesn't return a minimum of results, even though there ...
0
votes
1
answer
278
views
Throttling requests on AppEngine
My service sends messages to users, and I want to throttle on the following criteria; Saying a user A belongs to group G.
max 5 messages within last hour to user A
max 100 messages with last hour to ...
1
vote
1
answer
181
views
Google Cloud NDB integer vs urlsafe IDs?
The google-cloud-ndb Python library provides two ways of generating identifiers for Datastore entities:
integer_id(): Returns the ID as an integer.
urlsafe(): Returns a base64 string of the key.
If ...
0
votes
1
answer
59
views
Equivalent of remote_api_shell.py for cloud ndb?
For Python 2 GAE, remote_api_shell.py was super handy for making updates to live datastore.
With Python 3 GAE and cloud ndb, this doesn't work. Is there a good replacement?
1
vote
2
answers
100
views
dev_appserver.py can't find pkg_resources
As part of migrating from ndb to cloud-ndb with GAE Python 2, you need to add the following to appengine_config.py:
import pkg_resources
from google.appengine.ext import vendor
vendor.add('lib')
...
0
votes
1
answer
204
views
Wrapper for cloud NDB context when unit testing?
I'm migrating a Python 2 GAE app to Python 3, and I'm in the process of replacing ndb with cloud-ndb. This involves changing lines like
do_something_with_ndb()
to
with client.context() as context:
...
0
votes
0
answers
159
views
alternative to webapp2.WSGIApplication after migrating to google cloud ndb
I migrated from google.appengine.ext.webapp and ran into an issue with webapp2.WSGIApplication. I am using Django as the backend
the main part looks like this
application =webapp2.WSGIApplication([
...
0
votes
2
answers
323
views
Datastore Entity read (keys_only) inside ndb transactions
I have a question regarding the datastore entity reads inside a ndb transaction.
I know that when we read an entity inside an ndb transaction, that specific entity gets locked and no other thread can ...
1
vote
1
answer
165
views
Datastore delay on creating entities with put()
I am developing an application using with the Cloud Datastore Emulator (2.1.0) and the google-cloud-ndb Python library (1.6).
I find that there is an intermittent delay on entities being retrievable ...
0
votes
1
answer
48
views
Sporadically datastore entry not updated
In my python app, a function called through web API is adding new entries to NDB datastore table sd. It then updates the current entry in table cmpgn to append the reference to the new entry in sd. ...
0
votes
1
answer
39
views
Is there a pattern for declaring a computed key for a model?
I'd like a particular ndb.Model key's string id to be automatically set to the concatenation of two of the models' properties. These two properties are write-once, although other properties might ...
0
votes
1
answer
101
views
appengine migration from db to ndb: 500 error: 'PickleProperty' object has no attribute '_db_get_value'
I am in the process of migrating from db to ndb for my appengine site and i am getting the following error:
500 error: 'PickleProperty' object has no attribute '_db_get_value'
The full error is below:
...
1
vote
1
answer
56
views
google appengine db to ndb migration error: 'model_from_protobuf'
I am in the process of migrating from from db to ndb and i am getting an error in that i do not understand. It is coming from the following line:
return [db.model_from_protobuf(entity_pb.EntityProto(x)...
2
votes
3
answers
879
views
how can we run google app engine with python3 with ndb on local
I am using python google app engine
could you tell me, how i can run python3 google app engine with ndb on local system?
Help me
https://cloud.google.com/appengine/docs/standard/python3
3
votes
2
answers
341
views
Passing a cursor to ndb on Google App Engine Python 3 leads to an error
Note: This is happening on my development server (MAC running Mojave)
I'm running Python 3 on Google App Engine (standard environment) and I have the code below
cursor = ndb.Cursor(urlsafe = next_page)...
0
votes
1
answer
248
views
dev_appserver wont use my index.yaml python3.7
I'm in the process of upgrading a python2.7 gae std app to python3.7.
Everything is great except my indices just wont work.
I have a simple looking index.yaml file:
indexes:
- kind: Response
...
0
votes
0
answers
31
views
What is an Async run loop
I'm reading an architecture document and I stumbled on the term Async Run Loops and how NDB provides better Async run loops. However, I have been unable to find any explanation of the concept anywhere....
0
votes
1
answer
150
views
Datastore error: BadValueError: Expected integer, got [0, 1, 2, 3]
Others have reported a similar error, but the solutions given do not solve my problem.
For example there is a good answer here. The answer in the link mentions how ndb changes from a first use to a ...
0
votes
4
answers
186
views
Cursor implementation in NDB Model not working
DB Model
Hi,
Need advice on how to use cursor functions in NDB model.I am able to use with_cursor in DB model but its not available in NDB model:
DB Model
def myDBfn(self): ...
1
vote
1
answer
262
views
writing ndb query to return the entity key along with the entity
I have an ndb User model:
class User(ndb.Model):
active = ndb.BooleanProperty(default=True,required=True)
email= ndb.StringProperty(required=True)
that I call in order to retrieve a JSON ...
0
votes
1
answer
179
views
cloud ndb namespace per request
I'm trying to migrate our code to Cloud NDB. We have separate namespaces for each of our customers.
How can I safely switch namespace for each request?
I've implemented Flask middleware like the ...
2
votes
1
answer
622
views
Google Cloud Datastore Cursor with google.cloud.ndb
I am working with Google Cloud Datastore using the latest google.cloud.ndb library
I am trying to implement pagination use Cursor using the following code.
The same is not fetching the data correctly.
...
1
vote
1
answer
206
views
Cloud NDB: transactionally put() multiple entities
There are situations where we must save two or more datastore entities at once (either both entities are saved or neither is saved). For my example, I want to create a UserProfile entity when a User ...
0
votes
2
answers
245
views
Why is project id attached to my Datastore Key object?
For some inexplicable reason, my project id is attached to the Key of my User entity:
<Key('User', 5703358593630208), project=my-project-id>
This is giving me issues, such as when I am trying ...
1
vote
1
answer
140
views
Pagination not getting previous cursor google app engine in php
Hi have implement pagination in google app engine
with this code
https://github.com/GoogleCloudPlatform/php-docs-samples/blob/master/datastore/api/src/functions/concepts.php
function cursor_paging(...
0
votes
1
answer
78
views
Achieving the equivalence of ndb.StructuredProperty in new Cloud Datastore Mode?
In the old ndb Datastore, it is possible to create a StructuredProperty. This was thanks to the ndb.Model provided.
However, in the new Cloud Datastore, the ndb isn't available. So how could we ...
0
votes
1
answer
74
views
order by not working in Google App Engine php
I have used Google App Enginein PHP with ndb
Now I have to save data a model and fetch from that
$query = $datastore->query()
->kind('warehouse');
$result = $datastore->runQuery($...
1
vote
2
answers
212
views
How can I speed up or perftest context management in Google cloud-ndb library?
I'm in the process of migrating an app running in the Google App Engine Python 2.7 Standard Environment from the built-in NDB to library to the newer cloud-ndb library (prior to a migration to Python ...
7
votes
1
answer
710
views
How do you unit test Google Cloud NDB code?
The recommended path for upgrading a Python 2 AppEngine app to the new runtime is to switch datastore code to Google Cloud NDB. However, I can't find anything about unit testing code that uses Cloud ...
1
vote
0
answers
170
views
TypeError: Cannot filter a non-Node argument; received False
I am getting TypeError: Cannot filter a non-Node argument; received False on the second line of the following code (query1 = ...).
def checkExits(EVname,EVmanufacturer,EVyear):
query1 = EVModel....
0
votes
1
answer
167
views
Import Error when trying to migrate Google App Engine Python 2 app using NDB to the Cloud NDB Python 3 library
I am currently starting the process of preparing an App Engine app for Python 3 migration.
During the first step:
Migrate the App Engine bundled services in your Python 2 app to Google Cloud ...
0
votes
1
answer
35
views
Query highest number of one-to-many relationships
I have a "Like" system in place to track who likes what.
The Like model's parent is the object that is liked. This could be anything. For this example lets use a Car. The Like model also has an ...
0
votes
1
answer
102
views
Using datastore of appengine 1 for appengine 2
As Python 2 came to an end and App Engine 1 is no longer supported, we are migrating to App Engine 2. I have a sizable Datastore. Given that the two App Engines need to be on two different projects, ...
2
votes
1
answer
198
views
What are Best Practice for msgprop.EnumProperty and messages.Enum with Python 3 and Cloud NDB?
With Python 2 and NDB, we could store Enum in entities' properties this way:
from google.appengine.ext import ndb
from google.appengine.ext.ndb import msgprop
from protorpc import messages
class ...
0
votes
2
answers
239
views
Why iterating over ndb Datastore query consumes too much memory?
I have a query like:
query = HistoryLogs.query()
query = query.filter(HistoryLogs.exec_id == exec_id)
iter = query.iter()
for ent in iter:
# write log to file, nothing memory intensive
I added ...