coder_For_Life22
coder_For_Life22

Reputation: 26981

App Engine Several Databases For Databastore

I am thinking about using Google App Engine.

For my project I will need several data stored in different databases. From what I've been reading so far AppEngine only provides one database to store and track users.

My problem is I need to have multiple databases to store the same data but store only the data related to its criteria.

Is AppEngine the way to go for this? Its a android app I will be using by the way. Or should I have my own server? If so what would I need to implement?

Upvotes: 0

Views: 167

Answers (3)

coder_For_Life22
coder_For_Life22

Reputation: 26981

So after reading the documentation in the link @Moishe supplied in his answer, i figured out the answer.

I just thought i would post an answer here to save someone some time in the future.

Here is a class called employees that accepts App engines Datastore parameters.

//Class name Employee
class Employee(db.Model):

//Employee information we want to enter into the Employee entity.
first_name = db.StringProperty()
last_name = db.StringProperty()
hire_date = db.DateProperty()
attended_hr_training = db.BooleanProperty()

//Set employees information to the Database Model to be inserted into the Datastore.
employee = Employee(first_name='Antonio',
                last_name='Salieri')

employee.hire_date = datetime.datetime.now().date()
employee.attended_hr_training = True

//Like committ..this initiates the insertion of the information you put into the database store mode. This works sorta like androids bundle or SharedPreference you put the information into the datastore and then committ it or save it. 

employee.put()

Upvotes: 0

Moishe Lettvin
Moishe Lettvin

Reputation: 8471

Each entity you define (see https://developers.google.com/appengine/docs/python/datastore/entities) is conceptually like a table -- the entity's fields are the equivalent of columns in a table.

Upvotes: 1

voscausa
voscausa

Reputation: 11706

Can you explain, why you need more than one database. You can use namespaces to create a multitenancy environment. https://developers.google.com/appengine/docs/python/multitenancy/multitenancy

Upvotes: 2

Related Questions