[web2py] UPDATE with limit

2018-10-26 Thread Artem
Dear All , 
1. How to make DAL query with update only one/first record :
'UPDATE itft SET task_status = "S", w_id="w_id" WHERE task_status = "N" 
LIMIT 1;'
When i try something like:
db(db['itft']['task_status']=="N").update(task_status = "S",w_id= "w_id",
limitby=(0,1))
all rows with task_status == N get updated 
2. Is anyway to return updated row ID ? or how to update and select updated 
in one query ? 


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: web2py.component , ajax call always add ".load" to the first var

2018-08-03 Thread Artem
manage to find the error :
ajax("{{=URL(c='conc2', f='create_new_detail')}}" +'?t=' +t+ 
'_id='+c_id,[],'mbody_CRUD_Modal'); 

On Friday, August 3, 2018 at 6:47:23 PM UTC+8, Artem wrote:
>
> Hello , All!
> I load component via :
>
> $.web2py.component("{{=URL(c='conc2',f='c2.load')}}", 'conc_div') 
>
> component have ajax calls like :
>
> ajax("{{=URL(c='conc2', f='create_new_detail?t=')}}" +t+ 
> '_id='+c_id,[],'mbody_CRUD_Modal');
>
> when i send t and c_id vars to function with ajax call, and print them 
> out by console.log() in browser everything looks how is must be ,
> but ajax call always add .load  to the first var ...
>
> so for example i need  send to controller t='abc' and c_id='001' , but in 
> controller i receive t=.loadabc and c_id=001 .
>
>
>
>
>
>
>
>
>
>
>
> vxvxvxv   
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] web2py.component , ajax call always add ".load" to the first var

2018-08-03 Thread Artem
Hello , All!
I load component via :

$.web2py.component("{{=URL(c='conc2',f='c2.load')}}", 'conc_div') 

component have ajax calls like :

ajax("{{=URL(c='conc2', f='create_new_detail?t=')}}" +t+ 
'_id='+c_id,[],'mbody_CRUD_Modal');

when i send t and c_id vars to function with ajax call, and print them out 
by console.log() in browser everything looks how is must be ,
but ajax call always add .load  to the first var ...

so for example i need  send to controller t='abc' and c_id='001' , but in 
controller i receive t=.loadabc and c_id=001 .











vxvxvxv   

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] SQLFORM keepvalues

2018-07-22 Thread Artem
Dear All !
Is anyway to keepvalues only for particular fields with SQLFORM after form 
accepted ?
For now i'm using mysqlform.process(keepvalues=True) , and after form  
loaded clear all not needed fields with JS ,and as i have many forms with 
many fields , is real headache .

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] web2py + gevent

2018-07-11 Thread Artem
Dear All ,
Anybody using gevent with web2py ?
I always getting error :
>> greenlet.error: cannot switch to a different thread



>>gevent.exceptions.LoopExit: This operation would block forever
>> Hub: >0x119e9ba20 
thread_ident=0x123145489817600>>> threadpool=> 
>>thread_ident=0x7b2d2000>
>> Handles: []

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Write dynamic query in DAL without extra nested parentheses

2018-06-28 Thread Artem
Dear Antony ,
>From your example :
query = ' OR '.join(str(db.product.id == i) for i in [list of ids])
result type(query) is a string , could you tell me how to correctly convert 
it to the pydal.objects.Query / Set ?
I'm trying query = db(query) , and get a pydal.objects.Set , but can't use 
it , query.select() rise errors 
Thanks!


On Sunday, March 29, 2015 at 1:37:03 AM UTC+8, Anthony wrote:
>
> In this particular case, you should instead use .belongs():
>
> query = db.product.id.belongs([list of ids])
>
> It's an interesting problem, though. A somewhat hackish solution would be:
>
> query = ' OR '.join(str(db.product.id == i) for i in [list of ids])
>
> The problem is that OR and AND operators always wrap the operands in 
> parentheses, even when not necessary. The result is the nesting you observe 
> when using reduce() or appending in a loop. Perhaps there should be a way 
> to suppress the parentheses when not needed.
>
> Anthony
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Two database join query

2017-08-29 Thread Artem
Hi ,
yes i'm tried .
it rise error : OperationalError: no such table: table1 

On Tuesday, August 29, 2017 at 5:58:20 AM UTC+8, 黄祥 wrote:
>
> had you tried ?
> *e.g. not tested*
> rows = db(db1.table1.pid == db2.table2.pid).select()
>
> ref:
>
> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Inner-joins
>
> best regards,
> stifan
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Two database join query

2017-08-28 Thread Artem
My app require two database .
This why i post a question here ... 

On Tuesday, August 29, 2017 at 1:55:09 AM UTC+8, Alfonso Serra wrote:
I guess this is the solution:
https:
//stackoverflow.com/questions/6824717/sqlite-how-do-you-join-tables-from-different-databases
 


If you want to write simpler sqls, the tables should be within the same 
database.

   is no question to standard sqlite library , i think .

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Two database join query

2017-08-28 Thread Artem
Hello !
Hope someone can help . Thanks in advance !
I have two database :
db1 = DAL('sqlite://first.sqlite')
db2 = DAL('sqlite://second.sqlite')
with tables :
db1.define_table('table1',
Field('id',requires=IS_NOT_EMPTY()),
Field('pid',type='integer'),
Field('title',type='string'),
)
and
db2.define_table('table2',
Field('id',requires=IS_NOT_EMPTY()),
Field('pid',type='integer'),
Field('data',type='string'),
)
How to execute sqlite join ,something like: 
sql ="SELECT db1.id, db1.title,db2.data FROM db1.table1 INNER JOIN 
db2.table2 ON db2.table2.pid == db1.table1.pid"
db1.executesql(sql) doesn't work 


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Communication error

2017-08-15 Thread Artem
Hi!
Sos!
Communication error occurred permanently .
Admin interface running very slow .
../admin/errors and app/errors are empty .
How to define/fix the issue ?

2.15.3-stable+timestamp.2017.08.07.12.51.45
(Running on Rocket 1.2.6, Python 2.7.3)   

  

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.