Jonathan, thanks a ton.
--
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
Jonathan,
Thanks but output_batch is a* list* of dictionaries. So ultimately, it is a
list. Its elements are the dictionaries containing the key - value pairs
i.e. column name : column value . Therefore the order of the *list* should
be preserved.
--
You received this message because you are
Sorry, hadn't finished my morning coffee and this "registered" as a dict
ordering.
Without seeing code, it's hard to understand what is going on. Here's my
guess:
* When you call the insert(), the `output_batch` is inserted into the DB in
that order. This is expected and you should see that
Python dictionars do not preserve the order.
You could try using an
OrderedDict https://docs.python.org/2/library/collections.html
--
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,
Thanks guys. I'll add an id column and order by it.
--
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
On 12/04/2015 01:55 PM, Nana Okyere wrote:
> Much thanks.
> I think you may have hinted on something about the order in which the
> database returns rows. I thought that it always returns the rows in the
> order they were inserted. From what you're saying, that's a wrong
> assumption. So to
Yeah, you need an "id" field to do that and "ORDER BY" it. It's a
benefit/limitation of SQL -- save time by giving random rows, or spend time
sorting them.
Something that you should be wary of though...
If you do this:
INSERT INTO table (id) values (1,2,3,4...10);
Your select would be:
Much thanks.
I think you may have hinted on something about the order in which the
database returns rows. I thought that it always returns the rows in the
order they were inserted. From what you're saying, that's a wrong
assumption. So to give you a little more info, the data being written to