Releases: piccolo-orm/piccolo
0.65.1
Fixed bug with BaseUser
and Piccolo API.
0.65.0
The BaseUser
table hashes passwords before storing them in the database.
When we create a fixture from the BaseUser
table (using piccolo fixtures dump
), it looks something like:
{
"id": 11,
"username": "bob",
"password": "pbkdf2_sha256$10000$abc123"
}
When we load the fixture (using piccolo fixtures load
) we need to be careful in case BaseUser
tries to hash the password again (it would then be a hash of a hash, and hence incorrect). We now have additional checks in place to prevent this.
Thanks to @mrbazzan for implementing this, and @sinisaos for help reviewing.
0.64.0
Added initial support for ForeignKey
columns referencing non-primary key columns. For example:
class Manager(Table):
name = Varchar()
email = Varchar(unique=True)
class Band(Table):
manager = ForeignKey(Manager, target_column=Manager.email)
Thanks to @theelderbeever for suggesting this feature, and with help testing.
0.63.1
Fixed an issue with the value_type
of ForeignKey
columns when referencing a table with a custom primary key column (such as a UUID
).
0.63.0
Added an exclude_imported
option to table_finder
.
APP_CONFIG = AppConfig(
table_classes=table_finder(['music.tables'], exclude_imported=True)
)
It's useful when we want to import Table
subclasses defined within a module itself, but not imported ones:
# tables.py
from piccolo.apps.user.tables import BaseUser # excluded
from piccolo.columns.column_types import ForeignKey, Varchar
from piccolo.table import Table
class Musician(Table): # included
name = Varchar()
user = ForeignKey(BaseUser)
This was possible using tags, but was less convenient. Thanks to @sinisaos for reporting this issue.
0.62.3
0.62.2
Added a max password length to the BaseUser
table. By default it's set to 128 characters.
0.62.1
Fixed a bug with Readable
when it contains lots of joins.
Readable
is used to create a user friendly representation of a row in Piccolo Admin.
0.62.0
Added Many-To-Many support.
from piccolo.columns.column_types import (
ForeignKey,
LazyTableReference,
Varchar
)
from piccolo.columns.m2m import M2M
class Band(Table):
name = Varchar()
genres = M2M(LazyTableReference("GenreToBand", module_path=__name__))
class Genre(Table):
name = Varchar()
bands = M2M(LazyTableReference("GenreToBand", module_path=__name__))
# This is our joining table:
class GenreToBand(Table):
band = ForeignKey(Band)
genre = ForeignKey(Genre)
>>> await Band.select(Band.name, Band.genres(Genre.name, as_list=True))
[
{
"name": "Pythonistas",
"genres": ["Rock", "Folk"]
},
...
]
See the docs for more details.
0.61.2
Fixed some edge cases where migrations would fail if a column name clashed with a reserved Postgres keyword (for example order
or select
).
We now have more robust tests for piccolo asgi new
- as part of our CI we actually run the generated ASGI app to make sure it works (thanks to @AliSayyah and @yezz123 for their help with this).
We also improved docstrings across the project.