Re: [web2py] Re: Getting Too many tables error on GAE , HELP!

2011-10-24 Thread Phyo Arkar
Thanks.

So when i was student, i used to do joins programatically, that was 7 years
ago , and my teacher blame me how bad that design was.

Now thats gonna be a useful in NoSQL dbs

:).

On Mon, Oct 24, 2011 at 7:40 AM, howesc  wrote:

> it is very much a mindset.  joins are expensive no matter what system you
> use (well they are not free, though still very fast on a relational system),
> so when they build GAE which is supposed to be optimized for web page views,
> they disallowed joins.  i have a love/hate relationship with it!
>


Re: [web2py] Re: Getting Too many tables error on GAE , HELP!

2011-10-23 Thread howesc
it is very much a mindset.  joins are expensive no matter what system you 
use (well they are not free, though still very fast on a relational system), 
so when they build GAE which is supposed to be optimized for web page views, 
they disallowed joins.  i have a love/hate relationship with it!


Re: [web2py] Re: Getting Too many tables error on GAE , HELP!

2011-10-22 Thread Phyo Arkar
Oh Hell, To join programatically!! Ewww!!
Finally bad (relational) database designs are gonna look good in GAE,,

I think i am gonna brainwash myself and Jump onto NoSQL Bandwagon too

On Sun, Oct 23, 2011 at 5:46 AM, howesc  wrote:

> the default datastore for GAE is a NOSQL system of key-value pairs.  it
> does not have the full concept of referenced tables, and does not support a
> join operation.
>
> your options are to flatten your schema, putting all the necessary data in
> a single record rather than splitting it into many table, or to query the
> first table and then query the second table for the items referenced.  I use
> a combination of both.
>
> if you are not in a hurry, sign up for the beta access to SQL on GAE (my
> invite was not yet approved so i have not used it yet).  Massimo says it's
> great. :)
>
> cfh
>


[web2py] Re: Getting Too many tables error on GAE , HELP!

2011-10-22 Thread howesc
the default datastore for GAE is a NOSQL system of key-value pairs.  it does 
not have the full concept of referenced tables, and does not support a join 
operation.

your options are to flatten your schema, putting all the necessary data in a 
single record rather than splitting it into many table, or to query the 
first table and then query the second table for the items referenced.  I use 
a combination of both.

if you are not in a hurry, sign up for the beta access to SQL on GAE (my 
invite was not yet approved so i have not used it yet).  Massimo says it's 
great. :)

cfh


[web2py] Re: Getting Too many tables error on GAE , HELP!

2011-10-22 Thread Phyo Arkar
So because of join operation , it have problem with DAL over GAE right?

What is recommend work around for one to many relationship ?

Just use single table?

That gonna be awful..

On 10/23/11, Phyo Arkar  wrote:
> Anyone get this problem?
>
> I am using web2py 1.98.2 on GAE .
>
> WHat is the work around for it?
>
> On 10/23/11, Phyo Arkar  wrote:
>> def get_totals():
>>  response.generic_patterns = ['json']
>>  query=(db.item.id==db.sale.id_items)
>>  total_price = 0
>>  total_cost = 0
>>  total_items = 0
>>  rows =
>> db(query).select(db.item.base_price,db.item.price,db.sale.total_items)
>>  for r in rows:
>>  total_price += r.item.price * r.sale.total_items
>>  total_cost += r.item.base_price * r.sale.total_items
>>  total_items += r.sale.total_items
>>  profit =  total_price - total_cost
>>
>>  return dict(total_price = str(total_price) , total_profit =
>> str(profit) , total_items = str(total_items))
>>
>> This is waht i am doing. and i am getting this :
>>
>> Traceback (most recent call last):
>>   File
>> "/base/data/home/apps/s~herspos/1.354149753338895814/gluon/restricted.py",
>> line 192, in restricted
>> exec ccode in environment
>>   File
>> "/base/data/home/apps/s~herspos/1.354149753338895814/applications/HersPOS/controllers/default.py:get_totals",
>> line 218, in 
>>   File
>> "/base/data/home/apps/s~herspos/1.354149753338895814/gluon/globals.py",
>> line 145, in 
>> self._caller = lambda f: f()
>>   File
>> "/base/data/home/apps/s~herspos/1.354149753338895814/applications/HersPOS/controllers/default.py:get_totals",
>> line 168, in get_totals
>>   File
>> "/base/data/home/apps/s~herspos/1.354149753338895814/gluon/dal.py",
>> line 5481, in select
>> return self.db._adapter.select(self.query,fields,attributes)
>>   File
>> "/base/data/home/apps/s~herspos/1.354149753338895814/gluon/dal.py",
>> line 3292, in select
>> (items, tablename, fields) = self.select_raw(query,fields,attributes)
>>   File
>> "/base/data/home/apps/s~herspos/1.354149753338895814/gluon/dal.py",
>> line 3240, in select_raw
>> tablename = self.get_table(query)
>>   File
>> "/base/data/home/apps/s~herspos/1.354149753338895814/gluon/dal.py",
>> line 1052, in get_table
>> raise RuntimeError, "Too many tables selected"
>> RuntimeError: Too many tables selected
>>
>> How to not use 2 tables to make a relationship ? Just no relationship
>> at all GRR! ?
>>
>


[web2py] Re: Getting Too many tables error on GAE , HELP!

2011-10-22 Thread Phyo Arkar
Anyone get this problem?

I am using web2py 1.98.2 on GAE .

WHat is the work around for it?

On 10/23/11, Phyo Arkar  wrote:
> def get_totals():
>   response.generic_patterns = ['json']
>   query=(db.item.id==db.sale.id_items)
>   total_price = 0
>   total_cost = 0
>   total_items = 0
>   rows =
> db(query).select(db.item.base_price,db.item.price,db.sale.total_items)
>   for r in rows:
>   total_price += r.item.price * r.sale.total_items
>   total_cost += r.item.base_price * r.sale.total_items
>   total_items += r.sale.total_items
>   profit =  total_price - total_cost
>
>   return dict(total_price = str(total_price) , total_profit =
> str(profit) , total_items = str(total_items))
>
> This is waht i am doing. and i am getting this :
>
> Traceback (most recent call last):
>   File
> "/base/data/home/apps/s~herspos/1.354149753338895814/gluon/restricted.py",
> line 192, in restricted
> exec ccode in environment
>   File
> "/base/data/home/apps/s~herspos/1.354149753338895814/applications/HersPOS/controllers/default.py:get_totals",
> line 218, in 
>   File
> "/base/data/home/apps/s~herspos/1.354149753338895814/gluon/globals.py",
> line 145, in 
> self._caller = lambda f: f()
>   File
> "/base/data/home/apps/s~herspos/1.354149753338895814/applications/HersPOS/controllers/default.py:get_totals",
> line 168, in get_totals
>   File "/base/data/home/apps/s~herspos/1.354149753338895814/gluon/dal.py",
> line 5481, in select
> return self.db._adapter.select(self.query,fields,attributes)
>   File "/base/data/home/apps/s~herspos/1.354149753338895814/gluon/dal.py",
> line 3292, in select
> (items, tablename, fields) = self.select_raw(query,fields,attributes)
>   File "/base/data/home/apps/s~herspos/1.354149753338895814/gluon/dal.py",
> line 3240, in select_raw
> tablename = self.get_table(query)
>   File "/base/data/home/apps/s~herspos/1.354149753338895814/gluon/dal.py",
> line 1052, in get_table
> raise RuntimeError, "Too many tables selected"
> RuntimeError: Too many tables selected
>
> How to not use 2 tables to make a relationship ? Just no relationship
> at all GRR! ?
>