Skip to content

Releases: piccolo-orm/piccolo

0.38.1

Choose a tag to compare

@dantownsend dantownsend released this 26 Aug 06:31
bf280b1

Minor changes to get_or_create to make sure it handles joins correctly.

instance = (
    Band.objects()
    .get_or_create(
        (Band.name == "My new band")
        & (Band.manager.name == "Excellent manager")
    )
    .run_sync()
)

In this situation, there are two columns called 'name' - we need to make sure the correct value is applied if the row doesn't exist.

0.38.0

Choose a tag to compare

@dantownsend dantownsend released this 25 Aug 22:22

get_or_create now supports more complex where clauses. For example:

  row = await Band.objects().get_or_create(
      (Band.name == 'Pythonistas') & (Band.popularity == 1000)
  ).run()

And you can find out whether the row was created or not using row._was_created.

Thanks to @wmshort for reporting this issue.

0.37.0

Choose a tag to compare

@dantownsend dantownsend released this 25 Aug 20:28

Added ModelBuilder, which can be used to generate data for tests (courtesy @aminalaee).

0.36.0

Choose a tag to compare

@dantownsend dantownsend released this 25 Aug 16:14

Fixed an issue where like and ilike clauses required a wildcard (%). For example:

await Manager.select().where(Manager.name.ilike('Guido%')).run()

You can now omit wildcards if you like:

await Manager.select().where(Manager.name.ilike('Guido')).run()

Which would match on 'guido' and 'Guido', but not 'Guidoxyz'.

Thanks to @wmshort for reporting this issue.

0.35.0

Choose a tag to compare

@dantownsend dantownsend released this 25 Aug 11:33
  • Improved PrimaryKey deprecation warning (courtesy @tonybaloney).
  • Added piccolo schema generate which creates a Piccolo schema from an existing database.
  • Added piccolo tester run which is a wrapper around pytest, and temporarily sets PICCOLO_CONF, so a test database is used.
  • Added the get convenience method (courtesy @aminalaee). It returns the first matching record, or None if there's no match. For example:
manager = await Manager.objects().get(Manager.name == 'Guido').run()

# This is equivalent to:
manager = await Manager.objects().where(Manager.name == 'Guido').first().run()

0.34.0

Choose a tag to compare

@dantownsend dantownsend released this 22 Aug 19:05

Added the get_or_create convenience method (courtesy @aminalaee). Example usage:

manager = await Manager.objects().get_or_create(
    Manager.name == 'Guido'
).run()

0.33.1

Choose a tag to compare

@dantownsend dantownsend released this 22 Aug 09:38
  • Bug fix, where compare_dicts was failing in migrations if any Column had an unhashable type as an argument. For example: Array(default=[]). Thanks to @hipertracker for reporting this problem.
  • Increased the minimum version of orjson, so binaries are available for Macs running on Apple silicon (courtesy @hipertracker).

0.33.0

Choose a tag to compare

@dantownsend dantownsend released this 20 Aug 08:26

Fix for auto migrations when using custom primary keys (thanks to @adriangb and @aminalaee for investigating this issue).

0.32.0

Choose a tag to compare

@dantownsend dantownsend released this 17 Aug 20:06

Migrations can now have a description, which is shown when using piccolo migrations check. This makes migrations easier to identify (thanks to @davidolrik for the idea).

0.31.0

Choose a tag to compare

@dantownsend dantownsend released this 10 Aug 21:24

Added an all_columns method, to make it easier to retrieve all related columns when doing a join. For example:

await Band.select(Band.name, *Band.manager.all_columns()).first().run()

Changed the instructions for installing additional dependencies, so they're wrapped in quotes, to make sure it works on ZSH (i.e.
pip install 'piccolo[postgres]' instead of pip install piccolo[postgres]).