Hello.

I responded yesterday but it seems the mail did not make it. Here it goes and
sorry for the duplicate...


On 3.3.2016 21:09, Ladislav Lenart wrote:
> Hello.
> 
> 
> On 3.3.2016 19:52, Brian Cherinka wrote:
>> Yeah, that might ultimately be the best way to go if things get too 
>> complicated.
>>   I think people might not want to re-run several lines of code to change 
>> some
>> parameters but that could be a thing I make them just live with.
> 
> I think that the two concerns, namely:
> * update SQLAlchemy query / rebuild it from scratch
> * execute query manually / automatically
> are independent.
> 
> You could implement the following background task:
> * parse the code snippet
> * build the query from it / report errors to the user
> * execute the query
> * show / update results to the user
> and (re)schedule it in the near future whenever the user edits her code 
> snippet
> (like an incremental search).
> 
> But this starts to get complicated, i.e. the usual threading caveats apply.
> 
> HTH,
> 
> Ladislav Lenart
> 
> 
>> On Thursday, March 3, 2016 at 3:06:57 AM UTC-5, Ladislav Lenart wrote:
>>
>>     Hello.
>>
>>     I think it would be (much) easier to simply rebuild the query from 
>> scratch
>>     before each run. IMHO the time to build the query is not that big a 
>> factor to
>>     justify the added source code complexity.
>>
>>     HTH,
>>
>>     Ladislav Lenart
>>
>>
>>     On 3.3.2016 05:47, Brian Cherinka wrote:
>>     >
>>     >
>>     >     well you need a list of names so from a mapped class you can get:
>>     >
>>     >     for name in inspect(MyClass).column_attrs.keys():
>>     >         if name in <whatever my filter thing is>:
>>     >             q = q.filter_by(name = bindparam(name))
>>     >
>>     >     though I'd think if you're dynamically building the query you'd 
>> have the
>>     >     values already, not sure how it's working out that you need 
>> bindparam()
>>     >     at that stage...
>>     >
>>     >  
>>     > Ok.  I'll try this out. This looks like it could work.  I think I need 
>> it for
>>     > the cases where a user specifies a query with condition e.g. X < 10, 
>> runs it,
>>     > gets results.  Then they want to change the condition to X < 5 and 
>> rerun the
>>     > query.  As far as I know, if condition 2 gets added into the filter, 
>> you
>>     would
>>     > have both X < 10 and X < 5 in your filter expression.  Rather than a 
>> single
>>     > updated X < 5.
>>     >
>>     > What would be even more awesome is if there was a way to also update 
>> the
>>     > operator in place as well.  So changing X < 10 to X > 10.  
> 

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to