After a marathon of doc edits and fixes this weekend (and still so  
much on the docs is inaccurate...geez..) I've put out the first  
release of the 0.3.0 series.  Our last release was over 6 weeks ago  
which is way too long to be holding back the tons of little bugfixes  
that have piled up.  At the same time, a lot of internal re- 
architecting has gone on, particularly in the ORM, with an emphasis  
on clarifcation of concepts, removal of hacky/crufty ways of doing  
things, cutting down the tall weeds of things that were written a  
year ago, etc.  If you've ever wanted to tackle the ORM source code,  
this is the best time to do so, as a whole lot of stuff that nobody  
could ever understand, including me, has been ripped out and  
simplified, made more explicit, had logging added, etc.  The  
rearchitecting is the main reason i wanted to push onto a new major  
version number, since it pushes SA's "maturity" factor one notch up  
(i.e. a 3 on a scale of 1 to 10).

Some cool things that were impossible in the last release:

------------------------------------------

Define two tables with a circular foreign key dependency on each  
other !  (yes, it uses ALTER TABLE):

     t1 = Table('table1', meta,
        Column('id', Integer, primary_key=True),
        Column('t2_id', Integer, ForeignKey('t2.id'))
    )

    t2 = Table('table2', meta,
       Column('id', Integer, primary_key=True),
       Column('t1_id', Integer, ForeignKey('t1.id', use_alter=True,  
name='t2id_fk'))
    )

   meta.create_all()

Notice the "use_alter" flag, which also requires explicitly naming  
the foreign key.

------------------------------------------

UniqueConstraint :

    t1 = Table('sometable', meta, Column(...), UniqueConstraint('id',  
'version'))

------------------------------------------

  CheckConstraint:

    t1 = Table('sometable', meta, Column('x', Integer), Column('y',  
Integer), CheckConstraint('x+y>10'))

------------------------------------------

Fancy Query operations - per-query MapperExtensions, SelectResults  
can build joins on the fly:

   result = session.query(SomeClass).\
       options(extension(SelectResultsExt())).select().\
       outerjoin_to('orders').outerjoin_to('items').\
       select(or_(Order.c.order_id==None,Item.c.item_id==2)).list()

------------------------------------------

Pessimistic Locking (still needs documentation, spec is in ticket 292):

    q = session.query(SomeClass).with_lockmode('update').get(5)

------------------------------------------

Multi-column stored procedures as selectables (with supporting  
databases, i.e. postgres and oracle):

    myproc = select([
              column('x', type=Integer),
              column('y', type=Integer),
              column('status', type=String),
             ], from_obj=[func.my_stored_procedure(bindparam('x'),  
bindparam('y'), bindparam('z'))],
            engine=myengine
          )

   for row in myproc.execute(x=5,y=7,z=10):
     print row['x'], row['y'], row['status']

------------------------------------------

Individual TypeEngines now define the method used by the ORM to  
detect changes on an attribute (i.e. like Hibernate does), which  
supports "mutable" types such as PickleType:

    graphs = Table('graphs', meta, Column('id', Integer,  
primary_key=True),
             Column('data', PickleType)
       )

    class Graph(object):pass
    class Point(object):
       def __init__(self, x, y):
           self.x = x
           self.y = y

    mapper(Graph, graphs)

    g = Graph()
    g.data = [Point(1,2), Point(3,5), Point(10,15)]
    session.save(g)
    session.flush()
    session.clear()

    # changes within the contents of "data" are detected, even though no
    # "setter" operation occured on "g"
    g = session.query(Graph).get_by(id=g.id)
    g.data[2] = Point(19,12)
    session.flush()

PickleType can be set up with "mutable=False" if you want to prevent  
the comparison operation (or make your own PickleType with your own  
comparison operation).

------------------------------------------

full CHANGES list, which includes every enhancement and most bugfixes  
(minor bugfixes can be viewed on the timeline), can be viewed on the  
site:

        http://www.sqlalchemy.org/CHANGES


- mike






--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" 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/sqlalchemy
-~----------~----~----~----~------~----~------~--~---

Reply via email to