On 8/4/15 8:18 AM, Pavel S wrote:
Hi Michael,
why there's such condition testing value for None in JSONEncodeDict?
def process_bind_param(self, value, dialect):
*if value is not None:*
value = json.dumps(value)
return value
/json.dumps(None)/ returns /'null'/ which is absolutely valid JSON string.
it's a recipe. Please tailor it to your needs.
P
Dne pondělí 3. srpna 2015 15:26:07 UTC+2 Michael Bayer napsal(a):
On 8/3/15 3:13 AM, [email protected] <javascript:> wrote:
> On 2015-08-02 19:15 <[email protected] <javascript:>> wrote:
>> But what is about SQLAlchemy? I see nowhere a implementation of a
>> List() type that encapsulate that VARCHAR-depending converting
work?
> When implementing this myself. I am not sure if I have to use
> TypeDecorator
> or
> UserDefinedType
> as baseclass for that.
>
> I am not sure how this would look like.
>
> I need a list (undefined length) with tree values for each entry.
>
> x = [(1,2,3), (1,2,3), (1,2,3)]
>
The JSON type would give you a quick way to handle the list format:
http://docs.sqlalchemy.org/en/rel_1_0/core/custom_types.html#marshal-json-strings
<http://docs.sqlalchemy.org/en/rel_1_0/core/custom_types.html#marshal-json-strings>
if you have some other string format, substitute dumps() / loads().
--
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 [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.