A couple of questions on the tutorial:
1) Why .all() in 3rd (and some others) query code box, but not
others?
.all() is essentially equivalent to list(query). Some of the
examples already iterate the query, such as for x in query: print x,
others don't - but the tutorial wants you to see the results.
Ideally none of the examples would use all() since you generally
iterate to get results.
Ah OK.
Why or_(), and_(), in_(), but like().
(instead of like_() )
or/and/in are Python reserved words, it's convention per pep8 to
rename functions/variables with a trailing underscore if they conflict.
I see.
4) Common Filter Operators: Is '!= None' the correct way to get a NOT
NULL? (Not mentioned in tutorial)
that will work yes
5) Common Filter Operators: Using User.name.match raised an
(OperationalError) unable to use function MATCH in the requested
context... why? (using sqlite:memory is per tutorial)
MATCH is not supported by every database, SQLite is apparently one of
them. I'm a little surprised that operator found its way into the
tutorial since I've never used it
Thank you. A very clear explanation. :)
I don't know if the docs team reads this, but here are a couple of
comments:
1) Perhaps re-emphasize, in a few more places, SA's overloading of
the logical operators. I had forgotten that by the time I got to the
query filter section.
2) Since there are two alternative paths to take take in the class /
table building part (mapper / declarative), it not clear what the
prerequisites are for the 2nd path. To fix this, please show resetting
the python interpreter after the mapper example, and re-importing all
that is actually needed for the declarative version.
3) Mention the right way to filter by NOT NULL.
4) Mention the reservedword_() naming convention in passing. It
should be known to Python programmers, but since this is a tutorial,
it could be there are new Python users here as well.
5) Since the tutorial actually shows using SQLite, mention that
the .match() directive is not supported by SQLite.
I hope to finish the tutorial over the next few days, and may have
more comments then.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---