Skip to content

Releases: piccolo-orm/piccolo

0.65.1

21 Jan 07:50
Compare
Choose a tag to compare

Fixed bug with BaseUser and Piccolo API.

0.65.0

20 Jan 21:04
Compare
Choose a tag to compare

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

16 Jan 20:16
Compare
Choose a tag to compare

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

12 Jan 21:04
Compare
Choose a tag to compare

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

11 Jan 16:33
Compare
Choose a tag to compare

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

10 Jan 13:41
Compare
Choose a tag to compare

Fixed the error message in LazyTableReference.

Fixed a bug with create_pydantic_model with nested models. For example:

create_pydantic_model(Band, nested=(Band.manager,))

Sometimes Pydantic couldn't uniquely identify the nested models. Thanks to @wmshort and @sinisaos for their help with this.

0.62.2

31 Dec 06:51
Compare
Choose a tag to compare

Added a max password length to the BaseUser table. By default it's set to 128 characters.

0.62.1

22 Dec 00:13
Compare
Choose a tag to compare

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

19 Dec 20:49
Compare
Choose a tag to compare

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.

Many thanks to @sinisaos and @yezz123 for all the input.

0.61.2

14 Dec 21:42
Compare
Choose a tag to compare

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.