Bot releases are visible (Hide)
Published by kozlovsky almost 8 years ago
Published by kozlovsky about 8 years ago
Starting with this release Pony ORM is release under the Apache License, Version 2.0.
Before this release an exception that happened in a hook(https://docs.ponyorm.com/api_reference.html#entity-hooks), could be raised in two ways - either wrapped into the CommitException or without wrapping. It depended if the exception happened during the execution of flush() or commit() function on the db_session exit. Now the exception happened inside the hook never will be wrapped into the CommitException.
Published by kozlovsky about 8 years ago
strict
parameter: https://docs.ponyorm.com/transactions.html#strict
Published by kozlovsky over 8 years ago
See blog post for more detailed information: https://blog.ponyorm.com/2016/04/04/pony-orm-release-0-6-5/
Published by kozlovsky over 8 years ago
This release brings no new features, has no backward incompatible changes, only bug fixes.
If you are using obj.flush() method in your code we recommend you to upgrade to 0.6.4 release.
Published by kozlovsky over 8 years ago
This release was intended to fix the behavior of obj.flush(), but failed to do it in a proper way.
Please skip this release and update to 0.6.4 if you are using obj.flush() method.
obj.flush()
: assertion failed after exceptionobj.flush()
caused “release unlocked lock” error in SQLiteupper()
or lower()
does not work as expectedThese are long-standing bugs, but they were discovered just recently. The bugs were caused by incorrect implementation of obj.flush()
method. In the same time the global flush()
function worked correctly. Before this fix the method obj.flush()
didn’t call before_xxx
and after_xxx
hooks. In some cases it led to assertion error or some other errors when using SQLite.
Now both bugs are fixed and the method obj.flush()
works properly.
Since SQLite does not support Unicode operations, the upper()
and lower()
SQL functions do not work for non-ascii symbols.
Starting with this release Pony registers two additional unicode-aware functions in SQLite: py_upper()
and py_lower()
, and uses these functions instead of the standard upper()
and lower()
functions:
>>> select(p.id for p in Person if p.name.upper() == 'John')[:]
SQLite query:
SELECT "p"."id"
FROM "Person" "p"
WHERE py_upper("p"."name") = 'John'
For other databases Pony still uses standard upper()
and lower()
functions.
Published by kozlovsky almost 9 years ago
Blogpost: https://blog.ponyorm.com/2016/01/11/pony-orm-release-0-6-2/
The documentation was moved from this repo to a separate one at https://github.com/ponyorm/pony-doc
The compiled version can be found at https://docs.ponyorm.com
Published by kozlovsky over 9 years ago
select()
, filter()
, order_by()
, page()
, limit()
, random()
methods can be applied to collection attributesselect()
functionselect(x for x in BaseClass if x.subclass_attr == y)
db.insert(SomeEntity, column1=x, column2=y)
instead of db.insert(SomeEntity._table_, column1=x, column2=y)
global_stats_lock
is deprecated, just use global_stats
property without any lockingload()
method for entity instances which retrieves all unloaded attributes except collectionsload()
method for collections, e.g. customer.orders.load()
pony.converting.check_email()
Entity.order_by(..)
method was removed. Use Entity.select().order_by(...)
insteadPublished by kozlovsky almost 10 years ago
str
instead of unicode
for compatibility with Python 3int
with size=64
option instead of long
for compatibility with Python 3pymysql
adapter instead of MySQLdb
Published by kozlovsky almost 10 years ago
size
and unsigned
for int typelong
typesize
and unsigned
options for int
attributes link
Since the long
type has gone in Python 3, the long
type is deprecated in Pony now. Instead of long
you should use the int
type and specify the size
option:
class MyEntity(db.Entity):
attr1 = Required(long) # deprecated
attr2 = Required(int, size=64) # new way for using BIGINT type in the database
Published by kozlovsky about 10 years ago
This release fixes syntax errors during installation on ubuntu 14.04 (issue #81)
Published by kozlovsky about 10 years ago
Blog post: http://blog.ponyorm.com/2014/10/08/pony-orm-0-6-release-candidate-1
Now Pony treats both str
and unicode
attribute types as they are unicode strings in both Python 2 and 3. So, the attribute declaration attr = Required(str)
is equal to attr = Required(unicode)
in Python 2 and 3. The same thing is with LongStr
and LongUnicode
- both of them are represented as unicode strings now.
For the sake of backward compatibility Pony adds unicode
as an alias to str
and buffer
as an alias to bytes
in Python 3.
Published by kozlovsky about 10 years ago
pony.orm.serialization
module with the to_dict()
and to_json()
functions was added. Before this release you could use the to_dict()
method of an entity instance in order to get a key-value dictionary structure for a specific entity instance. Sometimes you might need to serialize not only the instance itself, but also the instance's related objects. In this case you can use the to_dict()
function from the pony.orm.serialization module.
Query.prefetch()
– allows to specify which related objects or attributes should be loaded from the database along with the query result . Example: select(s for s in Student).prefetch(Group, Department, Student.courses)
obj.flush()
– allows flush a specific entity to the databaseobj.get_pk()
– return the primary key value for an entity instancepy_check
parameter for attributes added. This parameter allows you to specify a function which will be used for checking the value before it is assigned to the attribute. The function should return True
/False
or can raise ValueError
exception if the check failed. Example: class Student(db.Entity):
name = Required(unicode)
gpa = Required(float, py_check=lambda val: val >= 0 and val <= 5)
time
and timedelta
– now you can use these types for attribute declaration. Also you can use timedelta
and a combination of datetime
+ timedelta
types inside queries.after_insert
, after_update
, after_delete
- these hooks are called when an object was inserted, updated or deleted in the database respectively (link)obj.order_by()
method is deprecated, use Entity.select().order_by()
insteadobj.describe()
now displays composite primary keysobj.to_dict()
should do flush at first if the session cache is modifiedto_dict()
when to-one attribute value is NoneERDiagramError: Entity class name should start with a capital letter
exceptionPublished by kozlovsky about 10 years ago
This release fixes the setup.py problem that was found after the previous release was uploaded to PyPI.
Published by kozlovsky about 10 years ago
http://blog.ponyorm.com/2014/08/11/pony-orm-release-0-5-2/
This release is a step forward to Python 3 support. While the external API wasn't changed, the internals were significantly refactored to provide forward compatibility with Python 3.
Published by kozlovsky over 10 years ago
Before this release, if a text attribute was defined without the max length specified (e.g. name = Required(unicode)
), Pony set the maximum length equal to 200 and used SQL type VARCHAR(200)
. Actually, PostgreSQL and SQLite do not require specifying the maximum length for strings. Starting with this release such text attributes are declared as TEXT
in SQLite and PostgreSQL. In these DBMSes, the TEXT
datatype has the same performance as VARCHAR(N)
and doesn't have arbitrary length restrictions.
For other DBMSes default varchar limit was increased up to 255 in MySQL and to 1000 in Oracle.
Published by kozlovsky over 10 years ago
Bugfix release
Published by kozlovsky over 10 years ago
Query.filter()
allows step-by-step query construction (link)Database.bind()
simplifies testing and allows using different settings for development and production (link)Query.page()
simplifies pagination (link)MyEntity.select_random(N)
is effective for large tables (link)Query.random(N)
for selecting random instances (link)concat()
function inside declarative queriesbefore_insert()
, before_update()
, before_delete()
entity instance hooks which can be overriddensequence_name='seq_name'
for PrimaryKey attributes for Oracle databaseoptions.MAX_FETCH_COUNT
is set to None
by default nowpony.__version__
attribute