Hi,
I am attempting to use Elixir to read data from a legacy table which
has a composite index.
The legacy table does not have an 'id' field.

I attempted to create a table with Elixir just as in the test files
and it worked fine - but it also
creates an id column.

Am I missing something?

thanks in advance for all help.

-sr

The table wrapper -
class TopicHistory(Entity):
  has_field('topicid',Integer)
  has_field('author',String(200))
  has_field('title',String(255))
  has_field('description', MSMediumText)
  has_field('state',SmallInteger)
  has_field('version',Integer)
  using_table_options(UniqueConstraint('topicid','version',
name='topichistory_ id'))
  using_options(metadata=codestriker, tablename='topichistory')

TopicHistory.select()   gives me this error -

Traceback (most recent call last):
  File "c:\elixir\test_topichistory.py", line 30, in <module>
    elements = TopicHistory.select(order_by='topichistory_topicid')
  File "c:\tools\python\25\lib\site-packages\SQLAlchemy-0.3.10-
py2.5.egg\sqlalchemy\ext\assignmapper.py", line 7, in do
    return getattr(query, name)(*args, **kwargs)
  File "c:\tools\python\25\lib\site-packages\SQLAlchemy-0.3.10-
py2.5.egg\sqlalchemy\orm\query.py", line 350, in select
    return self.select_whereclause(whereclause=arg, **kwargs)
  File "c:\tools\python\25\lib\site-packages\SQLAlchemy-0.3.10-
py2.5.egg\sqlalchemy\orm\query.py", line 359, in select_whereclause
    return self._select_statement(statement, params=params)
  File "c:\tools\python\25\lib\site-packages\SQLAlchemy-0.3.10-
py2.5.egg\sqlalchemy\orm\query.py", line 1072, in _select_statement
    return self.execute(statement, params=params, **kwargs)
  File "c:\tools\python\25\lib\site-packages\SQLAlchemy-0.3.10-
py2.5.egg\sqlalchemy\orm\query.py", line 971, in execute
    result = self.session.execute(self.mapper, clauseelement,
params=p)
  File "c:\tools\python\25\lib\site-packages\SQLAlchemy-0.3.10-
py2.5.egg\sqlalchemy\orm\session.py", line 194, in execute
    return self.connection(mapper,
close_with_result=True).execute(clause, params, **kwargs)
  File "c:\tools\python\25\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:\tools\python\25\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:\tools\python\25\lib\site-packages\SQLAlchemy-0.3.10-
py2.5.egg\sqlalchemy\engine\base.py", line 568, in execute_compiled
    self._execute_raw(context)
  File "c:\tools\python\25\lib\site-packages\SQLAlchemy-0.3.10-
py2.5.egg\sqlalchemy\engine\base.py", line 581, in _execute_raw
    self._execute(context)
  File "c:\tools\python\25\lib\site-packages\SQLAlchemy-0.3.10-
py2.5.egg\sqlalchemy\engine\base.py", line 599, in _execute
    raise exceptions.SQLError(context.statement, context.parameters,
e)
sqlalchemy.exceptions.SQLError: (OperationalError) (1054, "Unknown
column 'topichistory.id' in 'field list'") u'SELECT
topichistory.topicid AS topichistory_topicid, topichistory.description
AS topichistory_description, topichistory.title AS topichistory_title,
topichistory.author AS topichistory_author, topichistory.state AS
topichistory_state, topichistory.version AS topichistory_version,
topichistory.id AS topichistory_id \nFROM topichistory ORDER BY
topichistory_topicid' []


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