Datastore

57 views
Skip to first unread message

Spmadhu Priya

unread,
Apr 6, 2016, 5:26:28 AM4/6/16
to Google App Engine
Hi,
I want to store the data like below.
Suppose i am registering one person data

1. first admin_Username admin_Password admin_EMail
2.second admin_Username admin_Password admin_EMail

This above data is for sign up
Now i want to store the customer details of that account
For example 

under this email 1.Admin_email

1.firstcustomer name , email, password, address,phone number
2.second customer name , email, password, address,phone number
3.third customer name , email, password, address,phone number



under this email 2.Admin_email

1.firstcustomer name , email, password, address,phone number
2.second customer name , email, password, address,phone number
3.third customer name , email, password, address,phone number


Can you suggest me any of the techniques to store and retrive.

Anastasios Hatzis

unread,
Apr 6, 2016, 8:21:45 AM4/6/16
to google-a...@googlegroups.com
What authentication do you use in your app? Google Accounts API / Google Apps Domain? Custom authentication (e.g. webapp2)?

Is it intentional, that you mix authentication and roles into the same "person data"? If your app is more than rudimentary, I suggest to separate both concerns. Especially if it comes to authentication and user-related or other sensitive data, you don't want to replicate and maintain the models and code all over the place. In an ancient map, this territory would be named "Dragons Here" ;-)

What is the nature of the relationship between admins and customers? Is admin a key-account manager of these customers? Can one customer have more than one admin assigned? Or do you actually want to implement a multi-tenancy system with strictly separated customer data? In that case, namespaces could be a better approach.

Although, there are plenty of questions remaining, here a rather generic suggestion for your models:

User (for signup, login, password forgotten etc.)
- id/name (e.g. from Google, or your own)
- name
- email
- password (hash it or eternal hell awaits - better use Users API, if possible)

Admin
- id/name (same as in User?)
- phone
- address

Customer
- id/name (same as in User?)
- phone
- billing address
- invoice address
- admin: key (repeated?)

Basket, Purchase, Invoice,...
- parent : customer key
- id/name
- items
- date
- status etc...

User, Admin, and Customer would be with-out parents, that is, each forms its own entity-group. You would get strongly consistent views per customer with all their baskets, purchases, invoices etc. (but not a strongly consistent view across all customers of an admin).

If you want to prevent that a user can have more than one admin role or more than one customer role, you could assign the user ID/name to the associated admin or customer role. For example: Key(User, 123) -> Key(Customer, 123).

It would also help to consider your most frequent use-cases, i.e. which request handlers will be used most of the time and are most important (e.g. little latency for customers). Then evaluate what kind of datastore operations these request handler need. What information is read or queried and is eventually consistency ok or is strong consistency required? What information is written to the datastore and which of them must be inside transactions? Also how often will you need to write into the same entity groups? Answering these questions will help to decide how to model your entity groups, how granular or big your entity kinds are, which properties to index, or where you need a composite index.

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/28f34a6b-b299-4d73-8ee9-8627cb64fba1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Mit freundlichen Grüßen / Kind regards

i. A.
Anastasios Hatzis

Fon: +49 8374 930813
Fax: +49 8374 930810
Mobil: +49 1520 8592878

HATZIS Edelstahlbearbeitung GmbH
Hojen 2
87490 Haldenwang (Allgäu)
Germany

Handelsregister Kempten (Allgäu): HRB 4204
Geschäftsführer: Paulos Hatzis, Charalampos Hatzis
Umsatzsteuer-Identifikationsnummer: DE 128791802
GLN: 42 504331 0000 6

http://www.hatzis.de/
Reply all
Reply to author
Forward
0 new messages