I know, this is a really basic question, but...
Is there documentation or a tutorial on how to read from an existing database
using Elixir?
Is there any documentation that describes the differences between SQLAlchemy
and Elixir and when you should use Elixir and which parts you should use the
SQLAlchemy API for?
I've gone through the Elixir tutorial and looked over the SQLAlchemy
documention - not to mention searching the API on both -- even looked at some
of the Elixir sample code. Eventually, I hit a wall (no more Elixir
documentation that I could find).
Essentially, everything I see tells me how to create a new database connection
with new tables and new data, but not how to load a database long after it has
been made.
Of course, I could probably do this in no time using pure SQLAlchemy if I
followed their docs, but I wanted to do it with Elixir, which is probably
different, right?
BTW, here is an example of what I am trying:
from elixir import *
metadata.bind = "sqlite:///db.db"
class Planet(Entity):
date = Field(String)
cities = Field(Integer)
setup_all()
create_all()
Planet(date=url_date, cities=planet_numbers)
session.commit()
... and in another file to try and view the data:
from elixir import *
metadata.bind = "sqlite:///db.db"
setup_all()
create_all()
print metadata.sorted_tables
print Planet.query.all()
sorted_tables shows an empty list like so: []
Planet.query.all() gives an error: NameError: name 'Planet' is not defined
I also tried doing some stuff with sessions, per SQLAlchemy, but that didn't
work right (because I'm using Elixir). Of course, I could drop all Elixir
stuff and use only SQLAlchemy and probably get it to work just fine, but that
kinda defeats the purpose.
Another point of confusion is that is that I don't know where SQLAlchemy ends
and Elixir begins, or when I can safely mix stuff from SQLAlchemy and Elixir,
or when Elixir is supposed to be used instead of SQLAlchemy etc....
_________________________________________________________________
Hotmail: Trusted email with Microsoft's powerful SPAM protection.
http://clk.atdmt.com/GBL/go/177141664/direct/01/
http://clk.atdmt.com/GBL/go/177141664/direct/01/
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---