> You are missing the declaration of your classes here. What people
> usually do is have that in a seperate module and simply import the
> module at this point. If you don't do that, how is the program
> supposed to know what is that Janus class that you refer to? There is
> one way to do approximately what I think you want, you need to use the
> Sqlsoup SQLAlchemy extension, instead of Elixir.
Thanks for the suggestion to use Sqlsoup. Perhaps that is exactly what I need.
I was really getting kind of frustrated with it all by now. Hand-coding the
SQL queries myself almost seemed like an easier option than trying to make
sense of all the abstractions. :)
To answer your question, I fully expected SQLAlchemy/Elixir to load the data
(schema, tables, etc...) from the database and create the objects based on that
info. It seemed rather counterintuitive for it to require me to declare the
objects when all the data is right there in the database, which it could just
load into memory and/or create objects from. (so I thought :) )
One hurdle that I ran into was that the tutorials for SQLAlchemy/Elixir seemed
to have lots of gaps in understanding what was going on and/or how to do
certain things. I never got that feeling that it was taking me from a person
who has zero understanding of SQLAlchemy to a complete understanding of it all.
But, really, please don't let me upset anyone by saying that.
On a related, note, I wonder if it would be acceptable to make some suggestions
for the smaller Exlir tutorial?
1. How about... at the beginning, include or description or a simple link that
talks about what SQLAlchemy does and/or how it works. In other words a
description of how it hooks up python objects to datbase tables, autogenerates
the sql for you, connects to multiple databases, etc.... I know, very basic,
stuff, but also very important if someone wanders in and is wondering what it
is all about.
2. At the beginning, attempt to describe what Elixir is in relation to
SQLAlchemy -- how it makes typing less code, how it automatically creates an
SQLAlchemy session for you and other things it creates for you. Also, maybe
include items that it does not do for you or that you can still use from
SQLAlchemy. At each point, you would also have to keep in mind that the person
may not know SQLAlchemy; meaning the descriptions would have to describe
SQLAlchemy features or give a link to where they can learn them. Again, this
is also basic stuff, but it may help people who wonder in and don't have
familiarity with SQLAlchemy.
3. Perhaps you might consider adding a final section to the Elixir tutorial: a
section that talks about "loading data from the database"? In it, you could
explain how and why Elixir/SQLAlchemy needs to declare the object names for it
to work (meaning you have to know them beforehand). You could also point them
to Sqlsoup as a means to have the schema and tables loaded from the database
and turned into objects dynamically. If you want to get fancy, you could even
add an example of using Sqlsoup to retrieve the table names and then hooking
that data up into Elixir so that you can then use Elixir to work on those
tables.
Perhaps this might be useful... perhaps just a waste of time. Anyways, thanks
again for the mention of sqlsoup.
_________________________________________________________________
Windows 7: Unclutter your desktop.
http://go.microsoft.com/?linkid=9690331&ocid=PID24727::T:WLMTAGL:ON:WL:en-US:WWL_WIN_evergreen:112009
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"SQLElixir" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---