[sqlalchemy] Re: Tiny doc clarification request

2018-11-08 Thread Jonathan Vanasco


On Thursday, November 8, 2018 at 12:45:57 PM UTC-5, Lele Gaifax wrote:
>
> But maybe I'm missing some detail on the "engine specific" 
> implementations, 
> where, say, "foo['string']" may be considered a very different operation 
> than 
> "bar[2]"... 
>

Well that also has to do with whatever the object is

  foo = {'string': value}



vs

  bar = [1,2,3,4,5]



if you had in Python:

   foo = {'string': None, 2: 'two'}



it should encode to json where the key is a string:

'{"2": "two", "string": null}'


With that being stated, I have no idea what happens in SqlAlchemy or the 
various engines if you try to set `bar[2] = "two"'` when `bar` is a 
hash/dict/object.  something might raise an error, or `2` might be retyped 
into the string `"2"`,  or a database might possibly support an int as an 
object key (I have no idea if any of these happen, just rambling on 
potential compatibility points).

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
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.


[sqlalchemy] Re: Tiny doc clarification request

2018-11-08 Thread Lele Gaifax
Jonathan Vanasco  writes:

> is the list operation nested?
>
> i.e. the example states: 
>
>- 
>
>data_table.c.data[('key_1', 'key_2', 5, ..., 'key_n')]
>
>
> does that correspond to:
>
>  ['key_1']['key_2']['5']['...']['key_n'] = foo
>
>
> If so, it might make sense to call the first two "toplevel index 
> operations, by key or integer" and the latter "nested path operations".

Yes, that's how I "parsed" it: basically, the "two" distinct operations I see
are

a) simple "direct" lookup, be it either by string or by integer
b) "iterative"/"nested" lookup, one hop at a time over the provided sequence

But maybe I'm missing some detail on the "engine specific" implementations,
where, say, "foo['string']" may be considered a very different operation than
"bar[2]"...

ciao, lele.
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
l...@metapensiero.it  | -- Fortunato Depero, 1929.

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
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.