I used to do this a while back (about 3 years ago). I don't remember how, so maybe someone here can help me.
I create some entities in localhost datastore. Now I need to transfer the entities to the production datastore. I have existing entities in the store that I do not wish to delete. I just want to admit the additional data to production. Any ideas how I might do this?
You can enable remote API for your application, then use a locally running program to auth to the remote API and do datastore operations. This is outlined on the docs paged linked.
Related
Problem: Habitica is a habit-tracking app, but its personal data logs are not as detailed as I want. I want to create a local log of when I mark off habits/todo's in the app. Habitica offers certain webhooks that trigger when habits/todo's are checked off, which seems perfect for what I want, but how do I turn these triggers into a local log? I would like to use Python for this.
Ideas: It seems to me that I would need to set up some kind of personal cloud server to receive this data, turn it into a log, and then store it for download. I have previously deployed a Flask app using Heroku, so if this could be done similarly, that would be ideal. However, I don't know much about this, so I would welcome any ideas or advice.
Creating the Habitica webhook as Flask application is a good approach.
Heroku supports Python/Flask very nicely however the file system is ephemeral, hence it gets wiped out at every application restart.
In order to persist data you can look at various options:
save the file to AWS S3
save the data into a DB (Heroku has a free plan for PostgreSQL)
I am creating an inventory application for my company. The app has it's inventory information stored through RDS. I am using MySQL and have pymysql to connect. Throughout development I have had no issue connecting from the laptop that I created the database from. I want to know how to allow other computers with the application to connect. Is there a way to avoid adding each individual IP address to a security group? I would just like those with the application downloaded to have access without requiring additional login credentials.
When I use the application on my home computer I receive an error when trying to connect to the database.
pymysql.connect(db=dbname, host=host, port=port, user=user, password=password)
Side-note on security:
It is typically a very bad idea to grant remote applications direct access to your database, especially without giving each user/app their own password.
You are effectively opening your database to anyone that has the credentials, and you are including those credentials in the app itself. Somebody could obtain those credentials and, presumably, do quite a bit of damage to the contents of the database.
Also, you are locking-in your database schema with the inability to change in future. Let's say you have a table with particular columns and your application directly access that table. In future, if you modify the table, you should need to simultaneously update every application that is using the database. That's not really feasible if other people are running the application on their own systems.
The better approach is to expose an API and have the applications use the API to access the data:
The API should manage authentication, so you can determine who to allow in and, more importantly, track who is doing what. This will also avoid the problem of having to add each individual IP address of users, since you will be managing an authentication layer.
The API will apply a layer of business logic rather than allowing the remote application to do whatever it wishes. This stops remote users being able to do things like deleting the entire database. It also means that, instead of remote apps simply passing an SQL statement, they will need to pass information through the defined API (typically in the form of Action + Parameters).
It provides a stable interface into the application allowing you to make changes in the backend (eg changing the contents of a table) while still presenting the same interface to client applications.
Rule of thumb: Only one application server should be directly accessing a given database. You might have multiple servers running the same software to provide high availability and to support a high load of traffic, but don't let the client apps directly access the database. That's what makes a "3-tier" application so much better than a "2-tier" application. (Client - Server - Database)
I am attempting to create a python application on a Raspberry Pi that can access data stored in a db model on an App Engine application. Specifically the latest entry in the data store.
I have no experience doing this type of remote data access but have a fair bit of experience with App Engine and Python.
I have found very little that I understand on this subject of remote data access.
I would like to access the data store directly, not text on a web page like this.
ProtoRPC kind of looks like it may work but Im not familiar with it and it looks like it is pretty involved when I just need to access a few strings.
What would make the most sense to accomplish this? If an example is easy to provide I would appreciate it.
What you looking for is the appengine remote api.
https://cloud.google.com/appengine/docs/python/tools/remoteapi
Google App Engine doesn't allow direct access to it's databases from your local python script. Instead, only an application hosted on App engine's server can access that data for your application.
Essentially, you're looking for a Google App Engine compatible, automatic, Restful API. Several exist, and have been discussed here. YMMV with the various frameworks that are discussed there.
I am thinking about implementing resource throttling in my application in google app engine.
My idea is checking whether I am running out of resources (for example, bandwidth) and disabling part of the website, using the final part of the available daily traffic to inform the user that the site is running in a "resources saving" mode.
I read the GAE documentation, but I just found that if I run out of traffic, it directly returns HTTP 403.
Is there a way to make my python application aware of the used resources and to try not to be so rude with my users?
Unfortunately this is not possible, there is no API that you can use for this.
Looking at the App Engine roadmap there is no such feature coming along any time soon.
The only thing i can recommend is you sign up for billing and recieve the 50$ free quota, it's here till 31 october. You can enable billing and disable it and keep the free 50$!
Hope this helped.
I like to work with data saved in one GAE application in other GAE applications.
Basically share the datastore between multiple web applications in Google App Engine (Python) Development and Production.
Also if possible with:
http://localhost:####/_ah/admin/datastore
I like to view data in other applications not runnings and/or running on one screen?
Thanks for the help!
Nope, datastores are totally contained within the application. There is no direct sharing of data from one app to another.
You could however expose a web service to make data from one application available to another, using REST for example.
I guess the core problem here is that you would like to share the data between two applications hosted on GAE. There are two ways to do that.
You could use Google Cloud Datastore to store the information. This gives you more flexibility as you can have different services accessing datastore. You could even have something running on google compute engine and communicating with datastore.
Use google appengine modules. All modules share the same datastore. In your case each module could be a different application.
Hope this helps.
No, a datastore can only be accessed by one application (but that app can serve up multiple sites).
If you want Google to allow multiple applications to directly access the same datastore then you should star this issue:
http://code.google.com/p/googleappengine/issues/detail?id=1300
Unfortunately the way this issue is written is a bit ambiguous, but I take it to mean 'multiple applications' rather then 'multiple accounts'.
FWIW, you can deploy an application with another version and language - but with the same id, and be able to access its datastore concurrently