News for hackers. Stuff that matters.
Re:Migrating to Python 3 with pleasure by djrobstep on Sunday February 04, 2018 @08:11PM (#16305924)
Not the result set, the rows of the result set.
Re:Migrating to Python 3 with pleasure by jsjohnst on Sunday February 04, 2018 @10:26PM (#16306393)
Do you mean the columns of the row?
Re:Migrating to Python 3 with pleasure by djrobstep on Sunday February 04, 2018 @11:35PM (#16306622)
No, I mean the rows. Each row is semantically an ordered mapping.
Re:Migrating to Python 3 with pleasure by jsjohnst on Monday February 05, 2018 @08:09AM (#16308515)
Shouldn’t the collection of rows be a set or list, not a dictionary?

That said, you disagreed with my question then went on to show my question was on point.

The “rows themself” being an ordered map means you are referring to the columns, the order being set by the SELECT clause or table definition order (in case of wildcard).

That said, I personally feel iterating over table columns in that way to be a “bad code smell”. Not saying it’s bad in all cases, but generally it’s an anti-pattern to me.

Re:Migrating to Python 3 with pleasure by empthought on Monday February 05, 2018 @10:59AM (#16309571)
Order-significance is exactly how the relational model was defined in the beginning

"An array which represents an n-ary relation R has the following properties:

1. Each row represents an n-tuple of R.

2. The ordering of rows is immaterial.

3. All rows are distinct.

4. The ordering of columns is significant -- it corresponds to the ordering S1, S2, ..., Sn of the domains on which R is defined (see, however, remarks below on domain-ordered and domain-unordered relations).

5. The significance of each column is partially conveyed by labeling it with the name of the corresponding domain."

-- A relational model of data for large shared data banks[1]

[1]: https://cs.uwaterloo.ca/~david/cs848s14/codd-relational.pdf

Re:Migrating to Python 3 with pleasure by djrobstep on Monday February 05, 2018 @05:59PM (#16313034)
> Shouldn’t the collection of rows be a set or list, not a dictionary?

I didn't mention the collection of rows, I mentioned the rows themselves.

> The “rows themself” being an ordered map means you are referring to the columns

No, it means I'm referring to the rows themselves.

The rows themselves are each ordered mappings.

Hope this helps to clarify things. Happy to keep repeating this as many times as necessary.

Re:Migrating to Python 3 with pleasure by dragonwriter on Monday February 05, 2018 @06:08PM (#16313096)
I think the confusion is your use of “columns” or “columns of the row” to refer to attribute-value pairs that make up the row.
Re:Migrating to Python 3 with pleasure by icedchai on Sunday February 04, 2018 @10:07PM (#16306331)
Unless there is an "order by" clause, the order of rows in the result set is undefined and non-deterministic from query to query.
Re:Migrating to Python 3 with pleasure by djrobstep on Sunday February 04, 2018 @11:35PM (#16306616)
As I said:

> Not the result set, the rows of the result set.

Each row is a mapping with ordered keys.

Re:Migrating to Python 3 with pleasure by icedchai on Monday February 05, 2018 @09:17AM (#16308831)
Perhaps you are confused and mean "columns"? ("Rows of the result set" is what I was referring to.)

A result set has rows, which are not in a deterministic order unless an "order by" is provided. Each row has columns. The columns are in order, obviously.

Re:Migrating to Python 3 with pleasure by djrobstep on Monday February 05, 2018 @05:26PM (#16312818)
Perhaps you are confused and think I'm talking about the ordering of the result set.

I said that database query result rows are made up of ordered dictionaries. I didn't mention ordering of the result set.

Happy to keep repeating this as many times as necessary.

Re:Migrating to Python 3 with pleasure by icedchai on Tuesday February 06, 2018 @11:46AM (#16317438)
ok. We're actually saying the same thing, just in different words.