Hello!

I'm using sqlalchemy v0.3.10 and connecting to an existing table in
MSSQL with pymssql from a windows box.

I'm able to update existing records, but I can't insert new ones. The
error message says: "The current user is not the database or object
owner of table 'ttfvbs061100'. Cannot perform SET operation."

I can insert records with this user account from python with pymssql
in any database table, so it is not a permissions issue.

Thank you for any help!

Paulino


PS: Here is the script, the commands i sent from IDLE and the complete
traceback:


from sqlalchemy import *

db = create_engine('mssql://user:[EMAIL PROTECTED]/db')

metadata = BoundMetaData(db)

ppi = Table('ttfvbs061100', metadata,
            Column('t_year', Integer, primary_key=True),
            Column('t_dimx', String(), primary_key=True),
            Column('t_ceco', String(), primary_key=True),
            autoload = True)

class PPI(object):
    def __repr__(self):
        return "%s%s%s" %(self.t_dimx, self.t_ceco, self.t_desc)

ppimapper = mapper(PPI, ppi)
session = create_session()

>>> p = PPI()
>>> p.t_year = 2008
(...)
>>> session.save(p)
>>> session.flush()
Traceback (most recent call last):
  File "<pyshell#11>", line 1, in <module>
    session.flush()
  File "c:\python25\lib\site-packages\sqlalchemy-0.3.10-py2.5.egg
\sqlalchemy\orm\session.py", line 319, in flush
    self.uow.flush(self, objects)
  File "c:\python25\lib\site-packages\sqlalchemy-0.3.10-py2.5.egg
\sqlalchemy\orm\unitofwork.py", line 210, in flush
    flush_context.execute()
  File "c:\python25\lib\site-packages\sqlalchemy-0.3.10-py2.5.egg
\sqlalchemy\orm\unitofwork.py", line 400, in execute
    UOWExecutor().execute(self, head)
  File "c:\python25\lib\site-packages\sqlalchemy-0.3.10-py2.5.egg
\sqlalchemy\orm\unitofwork.py", line 1018, in execute
    self.execute_save_steps(trans, task)
  File "c:\python25\lib\site-packages\sqlalchemy-0.3.10-py2.5.egg
\sqlalchemy\orm\unitofwork.py", line 1032, in execute_save_steps
    self.save_objects(trans, task)
  File "c:\python25\lib\site-packages\sqlalchemy-0.3.10-py2.5.egg
\sqlalchemy\orm\unitofwork.py", line 1023, in save_objects
    task.mapper.save_obj(task.polymorphic_tosave_objects, trans)
  File "c:\python25\lib\site-packages\sqlalchemy-0.3.10-py2.5.egg
\sqlalchemy\orm\mapper.py", line 1210, in save_obj
    c = connection.execute(statement, params)
  File "c:\python25\lib\site-packages\sqlalchemy-0.3.10-py2.5.egg
\sqlalchemy\engine\base.py", line 517, in execute
    return Connection.executors[c](self, object, *multiparams,
**params)
  File "c:\python25\lib\site-packages\sqlalchemy-0.3.10-py2.5.egg
\sqlalchemy\engine\base.py", line 557, in execute_clauseelement
    return self.execute_compiled(elem.compile(dialect=self.dialect,
parameters=param), *multiparams, **params)
  File "c:\python25\lib\site-packages\sqlalchemy-0.3.10-py2.5.egg
\sqlalchemy\engine\base.py", line 567, in execute_compiled
    context.pre_exec()
  File "c:\python25\lib\site-packages\sqlalchemy-0.3.10-py2.5.egg
\sqlalchemy\databases\mssql.py", line 254, in pre_exec
    self.cursor.execute("SET IDENTITY_INSERT %s ON" %
self.dialect.preparer().format_table(self.compiled.statement.table))
  File "C:\Python25\Lib\site-packages\pymssql.py", line 126, in
execute
    self.executemany(operation, (params,))
  File "C:\Python25\Lib\site-packages\pymssql.py", line 152, in
executemany
    raise DatabaseError, "internal error: %s" % self.__source.errmsg()
DatabaseError: internal error: SQL Server message 8104, severity 16,
state 1, line 1:
The current user is not the database or object owner of table
'ttfvbs061100'. Cannot perform SET operation.
DB-Lib error message 10007, severity 5:
General SQL Server error: Check messages from the SQL Server.


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