What changes do I need for my tables to work on AppEngine's BigTable?
Asked Answered
C

2

4

Let's say I have a booking database consisting of users:

user_id
fname
lname

and their tickets

ticket_id
user_id
flight_no

and associated flights

flight_no
airline
departure_time
arrival_time

What would I need to change to move this Google AppEngine?

I understand AppEngine doesn't allow joins.

Does that mean my table should become one big schmudge of fields all lumped together?

bookings:

user_id
fname
lname
ticket_id
flight_no
airline
departure_time
arrival_time

In other words, all of my queries now run against the same table?

Champaigne answered 8/4, 2009 at 18:8 Comment(0)
F
7

What changes you need depends mostly on what queries you need to run, not on what data you have. Most likely you will only have to add a couple of things.

Make a list of queries and then take a look at Restrictions on Queries. After you've found the problematic ones, try to rewrite them with BigTable's constraints in mind.

For example, if you often need to find the number of tickets for a list of flights, you won't just be able to do:

SELECT
    flight_no, COUNT(*)
FROM
    flights
JOIN
    tickets ON tickets.flight_no = flights.flight_no
GROUP BY
    flight_no

So you'll need to add a counter of tickets to flights and increment/decrement that when creating/deleting tickets.

Good side of this is that BigTable forces you to have a very scalable database design. Bad side is that it wastes a lot of your time when you don't really need a scalable design.

Feebleminded answered 8/4, 2009 at 18:35 Comment(0)
A
1

You can use genuine SQL relational databases from Google appengine apps, through a webservice.

One such webservice is Rdbhost, at http://www.rdbhost.com .

It involves its compromises, particularly speed, in that each page view requires another backend http page request to the db server, but it allows you to use the SQL design knowledge you already have.

Ampliate answered 17/8, 2009 at 19:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.