[web2py] Re: GAE query cursors
thanks! now how do i go about updating the book to discuss these new features? On Sunday, June 17, 2012 9:09:33 PM UTC-7, Massimo Di Pierro wrote: uploading :-) On Sunday, 17 June 2012 10:40:51 UTC-5, howesc wrote: sorry if i confused you by submitting 2 non-inclusive patches. :( the reference patch for https://groups.google.com/forum/?fromgroups#!topic/web2py/mKgLFC5pxcY is what you applied, and with your change still works for me. if the cursor patch in this thread looks ok can you add it as well? this is the same patch file with updated line numbers for tip of tunk. thanks! christian On Saturday, June 16, 2012 3:04:00 PM UTC-7, Massimo Di Pierro wrote: In trunk with a minor change. Please make sure I did not break your patch. massimo On Saturday, 16 June 2012 13:59:34 UTC-5, howesc wrote: Hello again, I wanna use cursors on my GAE queries: https://developers.google.com/appengine/docs/python/datastore/queries#Query_Cursors i have attached a patch that adds an optional parameter reusecursor to select on GAE. If True, and the query has a limitby, it indicates that db['_lastcursor'] will have the cursor (i didn't want to store it if you are not gonna use it because i'm not sure of the cost of getting that cursor). If a reusecursor is a string that string will be passed to the GAE query as the cursor. Note that you must use limitby on all queries that you want to return the cursor for, and that queries that use a cursor must have the exact same filters. Keep in mind that limitby will be in relation to the cursor, so in most cases you want offset of 0. my suggested patch is attached. i welcome comments. example: def test3(): cursor = request.vars.cursor or True #say the manu_item has about a hundred rows rows = db(db.menu_item.id0).select(reusecursor=cursor, limitby=(0,10)) cursor = db['_lastcursor'] next_link = A('next', _href=URL(r=request, vars={'cursor':cursor})) # Use generic HTML views response.generic_patterns = ['html'] return dict( rows=rows, cursor=cursor, next_link = next_link) thanks, christian
[web2py] Re: GAE query cursors
Login and I will give you edit access. On Monday, 18 June 2012 14:44:39 UTC-5, howesc wrote: thanks! now how do i go about updating the book to discuss these new features? On Sunday, June 17, 2012 9:09:33 PM UTC-7, Massimo Di Pierro wrote: uploading :-) On Sunday, 17 June 2012 10:40:51 UTC-5, howesc wrote: sorry if i confused you by submitting 2 non-inclusive patches. :( the reference patch for https://groups.google.com/forum/?fromgroups#!topic/web2py/mKgLFC5pxcYis what you applied, and with your change still works for me. if the cursor patch in this thread looks ok can you add it as well? this is the same patch file with updated line numbers for tip of tunk. thanks! christian On Saturday, June 16, 2012 3:04:00 PM UTC-7, Massimo Di Pierro wrote: In trunk with a minor change. Please make sure I did not break your patch. massimo On Saturday, 16 June 2012 13:59:34 UTC-5, howesc wrote: Hello again, I wanna use cursors on my GAE queries: https://developers.google.com/appengine/docs/python/datastore/queries#Query_Cursors i have attached a patch that adds an optional parameter reusecursor to select on GAE. If True, and the query has a limitby, it indicates that db['_lastcursor'] will have the cursor (i didn't want to store it if you are not gonna use it because i'm not sure of the cost of getting that cursor). If a reusecursor is a string that string will be passed to the GAE query as the cursor. Note that you must use limitby on all queries that you want to return the cursor for, and that queries that use a cursor must have the exact same filters. Keep in mind that limitby will be in relation to the cursor, so in most cases you want offset of 0. my suggested patch is attached. i welcome comments. example: def test3(): cursor = request.vars.cursor or True #say the manu_item has about a hundred rows rows = db(db.menu_item.id0).select(reusecursor=cursor, limitby=(0,10)) cursor = db['_lastcursor'] next_link = A('next', _href=URL(r=request, vars={'cursor':cursor})) # Use generic HTML views response.generic_patterns = ['html'] return dict( rows=rows, cursor=cursor, next_link = next_link) thanks, christian
[web2py] Re: GAE query cursors
sorry if i confused you by submitting 2 non-inclusive patches. :( the reference patch for https://groups.google.com/forum/?fromgroups#!topic/web2py/mKgLFC5pxcY is what you applied, and with your change still works for me. if the cursor patch in this thread looks ok can you add it as well? this is the same patch file with updated line numbers for tip of tunk. thanks! christian On Saturday, June 16, 2012 3:04:00 PM UTC-7, Massimo Di Pierro wrote: In trunk with a minor change. Please make sure I did not break your patch. massimo On Saturday, 16 June 2012 13:59:34 UTC-5, howesc wrote: Hello again, I wanna use cursors on my GAE queries: https://developers.google.com/appengine/docs/python/datastore/queries#Query_Cursors i have attached a patch that adds an optional parameter reusecursor to select on GAE. If True, and the query has a limitby, it indicates that db['_lastcursor'] will have the cursor (i didn't want to store it if you are not gonna use it because i'm not sure of the cost of getting that cursor). If a reusecursor is a string that string will be passed to the GAE query as the cursor. Note that you must use limitby on all queries that you want to return the cursor for, and that queries that use a cursor must have the exact same filters. Keep in mind that limitby will be in relation to the cursor, so in most cases you want offset of 0. my suggested patch is attached. i welcome comments. example: def test3(): cursor = request.vars.cursor or True #say the manu_item has about a hundred rows rows = db(db.menu_item.id0).select(reusecursor=cursor, limitby=(0,10)) cursor = db['_lastcursor'] next_link = A('next', _href=URL(r=request, vars={'cursor':cursor})) # Use generic HTML views response.generic_patterns = ['html'] return dict( rows=rows, cursor=cursor, next_link = next_link) thanks, christian cursorpatch2.out Description: Binary data
[web2py] Re: GAE query cursors
uploading :-) On Sunday, 17 June 2012 10:40:51 UTC-5, howesc wrote: sorry if i confused you by submitting 2 non-inclusive patches. :( the reference patch for https://groups.google.com/forum/?fromgroups#!topic/web2py/mKgLFC5pxcY is what you applied, and with your change still works for me. if the cursor patch in this thread looks ok can you add it as well? this is the same patch file with updated line numbers for tip of tunk. thanks! christian On Saturday, June 16, 2012 3:04:00 PM UTC-7, Massimo Di Pierro wrote: In trunk with a minor change. Please make sure I did not break your patch. massimo On Saturday, 16 June 2012 13:59:34 UTC-5, howesc wrote: Hello again, I wanna use cursors on my GAE queries: https://developers.google.com/appengine/docs/python/datastore/queries#Query_Cursors i have attached a patch that adds an optional parameter reusecursor to select on GAE. If True, and the query has a limitby, it indicates that db['_lastcursor'] will have the cursor (i didn't want to store it if you are not gonna use it because i'm not sure of the cost of getting that cursor). If a reusecursor is a string that string will be passed to the GAE query as the cursor. Note that you must use limitby on all queries that you want to return the cursor for, and that queries that use a cursor must have the exact same filters. Keep in mind that limitby will be in relation to the cursor, so in most cases you want offset of 0. my suggested patch is attached. i welcome comments. example: def test3(): cursor = request.vars.cursor or True #say the manu_item has about a hundred rows rows = db(db.menu_item.id0).select(reusecursor=cursor, limitby=(0,10)) cursor = db['_lastcursor'] next_link = A('next', _href=URL(r=request, vars={'cursor':cursor})) # Use generic HTML views response.generic_patterns = ['html'] return dict( rows=rows, cursor=cursor, next_link = next_link) thanks, christian
[web2py] Re: GAE query cursors
In trunk with a minor change. Please make sure I did not break your patch. massimo On Saturday, 16 June 2012 13:59:34 UTC-5, howesc wrote: Hello again, I wanna use cursors on my GAE queries: https://developers.google.com/appengine/docs/python/datastore/queries#Query_Cursors i have attached a patch that adds an optional parameter reusecursor to select on GAE. If True, and the query has a limitby, it indicates that db['_lastcursor'] will have the cursor (i didn't want to store it if you are not gonna use it because i'm not sure of the cost of getting that cursor). If a reusecursor is a string that string will be passed to the GAE query as the cursor. Note that you must use limitby on all queries that you want to return the cursor for, and that queries that use a cursor must have the exact same filters. Keep in mind that limitby will be in relation to the cursor, so in most cases you want offset of 0. my suggested patch is attached. i welcome comments. example: def test3(): cursor = request.vars.cursor or True #say the manu_item has about a hundred rows rows = db(db.menu_item.id0).select(reusecursor=cursor, limitby=(0,10)) cursor = db['_lastcursor'] next_link = A('next', _href=URL(r=request, vars={'cursor':cursor})) # Use generic HTML views response.generic_patterns = ['html'] return dict( rows=rows, cursor=cursor, next_link = next_link) thanks, christian
[web2py] Re: GAE Query
if your domain is bob.com, you cannot map http://bob.com to GAE, but you can map http://www.bob.com to GAE. so you just have to manage your sub-domains properly. (yes, www is considered a sub-domain) cfh
[web2py] Re: GAE Query
yes you have to set your GAE app on a subdomain. but that is the *only* supported configuration that i know of. google does not allow mapping of naked domains as they call it to a GAE app.
[web2py] Re: GAE Query
So if using GAE on a subdomain for a homepage would use redirect users to the subdomain? I think i am even more confused now1 On Feb 7, 4:57 pm, howesc how...@umich.edu wrote: yes you have to set your GAE app on a subdomain. but that is the *only* supported configuration that i know of. google does not allow mapping of naked domains as they call it to a GAE app.
[web2py] Re: GAE Query
I think I understand that. I have GAE on my primary domain, I have one sub domain with a very basic site that I was referring all traffic to before I was ready to deploy my web2py app. app.yaml is set to ignore all applications except my website app. routes.py is set to have my website app as the default. How do I access files at my primary domain that are ot part of my GAE app? Is this only possible by setting my GAE app on a subdomain? On Feb 3, 11:31 pm, sc how...@umich.edu wrote: this depends on many factors including: * DNS config for the domain and sub-domains * app.yaml * routes.py if you have the GAE app on 1 subdomain, and other web services on another subdomain that is fine. if all traffic is going to the same sub-domain which is mapped to GAE, GAE will service all those requests. whether or not web2py services a GAE request depends on app.yaml (i believe the default app.yaml tells GAE to serve the static files up directly without invoking web2py for example). hope that helps some. cfh
[web2py] Re: GAE Query
this depends on many factors including: * DNS config for the domain and sub-domains * app.yaml * routes.py if you have the GAE app on 1 subdomain, and other web services on another subdomain that is fine. if all traffic is going to the same sub-domain which is mapped to GAE, GAE will service all those requests. whether or not web2py services a GAE request depends on app.yaml (i believe the default app.yaml tells GAE to serve the static files up directly without invoking web2py for example). hope that helps some. cfh