That works. Thank's a lot.
Marcos.
I will continue asking. Soon...
On Dec 14, 7:20 pm, [EMAIL PROTECTED] wrote:
your 'iva' table-column AND 'iva' attribute/relation/property have same
name, Thats what the error says. either rename one of them (e.g. the column
to become iva_id), or use that allow_column_override=True flag to the
producto mapper.
Marcos wrote:
Hello, first at all, sorry about my english... I'm from Mendoza,
Argentina, and I'm starting with this. Because I can't describe my
problem, I will show the next:
from sqlalchemy import *
from sqlalchemy.orm import *
class Producto(object):
pass
class Iva(object):
pass
metadata = MetaData()
engine = create_engine('postgres://postgres:[EMAIL PROTECTED]:5432/
marcos')
connection = engine.connect()
Session = sessionmaker(bind=connection, autoflush=True,
transactional=True)
session = Session()
iva_tabla = Table( 'iva' , metadata ,
Column('id' , Integer , primary_key =
True) ,
Column('valor', Float)
)
productos_tabla = Table ( 'productos' , metadata ,
Column('id', Integer ,
primary_key = True ) ,
Column('nro' , Integer ) ,
Column('descripcion' ,
String(100) ) ,
Column('iva' , Integer ,
ForeignKey('iva.id')) ,
Column('precioUnitario' ,
Float )
)
mapper(Producto, productos_tabla , properties={'iva':relation(Iva)})
mapper(Iva,iva_tabla)
- And when i run it:
raceback (most recent call last):
File /home/instancia_webware/MyContext/Pruebas/sql.py, line 29,
in ?
mapper(Producto, productos_tabla ,
properties={'iva':relation(Iva)})
File /usr/lib/python2.4/site-packages/SQLAlchemy-0.4.1-py2.4.egg/
sqlalchemy/orm/__init__.py, line 518, in mapper
return Mapper(class_, local_table, *args, **params)
File /usr/lib/python2.4/site-packages/SQLAlchemy-0.4.1-py2.4.egg/
sqlalchemy/orm/mapper.py, line 154, in __init__
self._compile_properties()
File /usr/lib/python2.4/site-packages/SQLAlchemy-0.4.1-py2.4.egg/
sqlalchemy/orm/mapper.py, line 612, in _compile_properties
self._compile_property(column_key, column, init=False,
setparent=True)
File /usr/lib/python2.4/site-packages/SQLAlchemy-0.4.1-py2.4.egg/
sqlalchemy/orm/mapper.py, line 654, in _compile_property
raise exceptions.ArgumentError(WARNING: column '%s' not being
added due to property '%s'. Specify 'allow_column_override=True' to
mapper() to ignore this condition. % (column.key, repr(prop)))
sqlalchemy.exceptions.ArgumentError: WARNING: column 'iva' not being
added due to property 'sqlalchemy.orm.properties.PropertyLoader
object at 0xb7aba1cc'. Specify 'allow_column_override=True' to
mapper() to ignore this condition.
--
I've read a lot, and I can't or I'm incapable to resolve this by
myself. Can anybody help me?
Sorry again, Marcos
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---