tempUserList = session.query(User.name, User.expenses).all() ?

--- On Wed, 8/25/10, dls <[email protected]> wrote:

> From: dls <[email protected]>
> Subject: [elixir] simple table migration without SQLAlchemy_migrate
> To: "SQLElixir" <[email protected]>
> Date: Wednesday, August 25, 2010, 7:21 PM
> Hi all - I understand that
> SQLAlchemy_migrate exists to facilitate SQL
> table migrations for SQLAlchemy (and Elixir) based
> projects, but after
> reviewing the documentation I *think* that
> SQLAlchemy_migrate is too
> heavy-duty for what I'm trying to do. I have a
> non-production,
> completely for fun project and I'm trying to perform the
> following
> simple migration:
> 
> (btw - I'm basically a database newbie...)
> 
> (1) version 1.0 of my Elixir table was this:
> 
> class User(Entity):
>     name     = Field(String,
> unique=True)
>     expenses     =
> OneToMany('Expense')
> 
>     def __repr__(self):
>         return "<User
> ('%s')>" % (self.name)
> 
> and several records of this class exist. The 'Expense'
> table exists as
> well, but is not shown here. Version 2.0 of the User table
> is this:
> 
> class User(Entity):
>     name     = Field(String,
> unique=True)
>     expenses     =
> OneToMany('Expense')
>     default      =
> Field(Integer)
> 
>     def __repr__(self):
>         return "<User
> ('%s')>" % (self.name)
> 
> Note the addition of a single simple field. When my tool
> initializes
> it will notice the difference through use of a Version
> table and
> determine if needs to perform a migration (working
> correctly). I want
> it to dump all the data from version 1.0 of the User table
> and then
> load it into version 2.0 of the User table, adding the
> default column
> as I go. My Elixir User class is ready to go at version
> 2.0, but this
> code:
> 
> #dump all entries
> tempUserList = User.query.all(  )
> 
> fails, because the table in the database doesn't contain a
> 'default'
> column. I also tried:
> 
> tempUserList = session.query(User.name, User.expenses)
> 
> but this seems to return the SQL statements instead of the
> actual
> data. Suggestions?
> 
> -- 
> 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.
> 
> 


      

-- 
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.

Reply via email to