[PonyORM-list] problems with Date field defenition

Вадим Бажов vadim at ideco.ru
Thu Jul 31 10:33:29 UTC 2014


Hi people !

Whenever i create a date or datetime field in entity python always gives 
me an exception:

"NameError: name 'date' is not defined" for "date = Required(date)" 
record according your documentation documentation

"pony.orm.core.ERDiagramError: Entity definition date was not found" for 
"date = Required('date')"

I am trying to run i file with folowing code:

#!/usr/bin/python

# -*- coding: utf-8 -*-

from pony.orm import *

db = Database('sqlite', 'db.sqlite', create_db=True)

class subscribers(db.Entity):

     id = PrimaryKey(int, auto=True)

     email   = Optional(str)

     date = Required(date)

sql_debug(True)

db.generate_mapping(create_tables=True)


Running that code from python shell gives me the following:

>>> from pony.orm import *

>>> db = Database('sqlite', '/tmp/db.sqlite', create_db=True)

GET NEW CONNECTION

RELEASE CONNECTION

>>> class subscribers(db.Entity):

...     id = PrimaryKey(int, auto=True)

...     email   = Optional(str)

...     date = Required('date')

...

>>> sql_debug(True)

>>> db.generate_mapping(create_tables=True)

Traceback (most recent call last):

   File "<stdin>", line 1, in <module>

   File "<auto generated wrapper of generate_mapping() function>", line 2, in generate_mapping

   File "/usr/local/lib/python2.7/dist-packages/pony/orm/core.py", line 2698, in _resolve_attr_types_

     throw(ERDiagramError, 'Entity definition %s was not found' % py_type)

   File "/usr/local/lib/python2.7/dist-packages/pony/utils.py", line 126, in throw

     raise exc  # Set "pony.options.CUT_TRACEBACK = False" to see full traceback

pony.orm.core.ERDiagramError: Entity definition date was not found


So database can't be created after all.

Pony version installed with pip:

pony                      - Pony Object-Relational Mapper

   INSTALLED: 0.5.1

   LATEST:    0.5-beta

Is it a bug or something? How i should create a datefield with Pony ?

I've couldn't create a table with several tables with Pony until i 
commented out all datefields strings from the code. So Pony works if i 
don't use datetime fields.


-- 
С уважением,
Бажов Вадим,
Инженер отдела технической поддержки,
Компания Айдеко
--
Телефоны: +7 (495) 987-32-70; +7 (495) 662-87-34 (тех. поддержка); +7 (343) 345-15-75; Факс: +7 (343) 383-75-13

Электронная почта:
Вопросы по приобретению: sales at ideco.ru
Технические вопросы: support at ideco.ru
Партнерство: partners at ideco.ru
Общие вопросы: info at ideco.ru

Сайт: http://www.ideco.ru/
Форум: http://www.ideco.ru/forum/



More information about the ponyorm-list mailing list