Sorry because i'm a bit late (  work deadlines are struggling my
time! :) ).
I've made some different configurations and schema definitions... and
i've noticed that it never updates a row if i set the datetime field
as PK ( never! even if i set it as the only PK .. ). If i set
composite PKs excluding any datetime column everything works fine ( it
also works if i set a datetime as PK at the database side and
excluding it at the schema on sqlalchemy side.. ). Sorry about the
mess with the PKs between the former examples but i was only trying to
say that changing the schema results that everything works fine...

Here's a little piece of code just as an example to start playing...
( it works  for me.., but if i include start as PK it "crashes")

import sqlalchemy as sa
import datetime, time
from sqlalchemy.orm import sessionmaker

sa_engine=sa.create_engine("mssql://sa:[EMAIL PROTECTED]/siaDB_BR",
echo=True)
metadata = sa.MetaData(sa_engine)
Session = sessionmaker(bind=sa_engine, autoflush=True,
transactional=True)
sa_session = Session()


jobs = sa.Table('jobs', metadata,
                                sa.Column('identifier', sa.Numeric(18),
primary_key=True),
                                sa.Column('section', sa.VARCHAR(20)),
                                sa.Column("start",sa.DateTime),
                                sa.Column("stop",sa.DateTime),
                                sa.Column("station", sa.VARCHAR(20),  
primary_key=True),
                                autoload=False)#ok

class Job(object):
        def __init__(self, identifier, start, station="TCHUKI"):
                self.identifier, self.start, self.station=identifier, start, 
station

sa.orm.mapper(Job, jobs)

j = Job(22, datetime.datetime.now())
sa_session.save(j)
sa_session.commit()
sa_session.clear()
time.sleep(1)
j1=sa_session.query(Job).all()[0]
j1.stop=datetime.datetime.now()
sa_session.save_or_update(j1)
sa_session.commit()







On 12 Dic, 17:54, "Rick Morrison" <[EMAIL PROTECTED]> wrote:
> Hey Fabio, would you please post a full non-working copy with the new schema
> and all the PKs that you want set up? There are a few too many variants in
> this thread to see what's going on now. Your earlier versions didn't include
> 'station' as a PK, but did include 'start', while this one's the opposite.
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to