Well I was hoping to "just use yaml" since yaml understands when two
objects refer to the same underlying object. That means you don't have to
write any logic to de-duplicate objects through relationships, etc.

Since json doesn't have the notion of referencing, that doesn't seem
straightforward there.

I was also hoping to "just use yaml" to avoid writing custom dumping code,
since it seems in general like a useful capability. So I may yet try and
find the underlying bug and fix it.

On 24 October 2014 15:29, Jonathan Vanasco <jvana...@gmail.com> wrote:

>
> Usually for this sort of stuff, I serialize the object's data into a JSON
> dict ( object columns to JSON dict, object relations to a dict, list of
> dicts, or reference to another object).  ( Custom dump/load is needed to
> handle Timestamp, Floats, etc).  You might be able to iterate over the data
> in YAML and not require custom encoding/decoding.  When I need to treat
> the json data as objects, I'll load them into a custom dict class that will
> treat attributes as keys.
>
> The downside of this is that you don't have all the SqlAlchemy relational
> stuff or any ancillary methods (though they can be bridged in with more
> work).  The benefit though is that you can get a nearly 1:1 parity between
> the core needs without much more work.  When using a "read only" context,
> you can flip between SqlAlchemy objects and dicts.  If you need to use the
> SqlAlchemy model itself, you could load the column/relationship data into
> it manually.
>
> --
> 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 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 sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to