Releases: piccolo-orm/piccolo
1.12.0
1.11.0
Added datetime functions, for example Year
:
>>> from piccolo.query.functions import Year
>>> await Concert.select(Year(Concert.starts, alias="starts_year"))
[{'starts_year': 2024}]
Added the Concat
function, for concatenating strings:
>>> from piccolo.query.functions import Concat
>>> await Band.select(
... Concat(
... Band.name,
... '-',
... Band.manager._.name,
... alias="name_and_manager"
... )
... )
[{"name_and_manager": "Pythonistas-Guido"}]
1.10.0
Added not_any
method for Array
columns. This will return rows where an array doesn't contain the given value. For example:
class MyTable(Table):
array_column = Array(Integer())
>>> await MyTable.select(
... MyTable.array_column
... ).where(
... MyTable.array_column.not_any(1)
... )
[{"array_column": [4, 5, 6]}]
Also fixed a bunch of Pylance linter warnings across the codebase.
1.9.0
Added some math functions, for example Abs
, Ceil
, Floor
and Round
.
>>> from piccolo.query.functions import Round
>>> await Ticket.select(Round(Ticket.price, alias="price"))
[{'price': 50.0}]
Added more operators to QueryString
(multiply, divide, modulus, power), so we can do things like:
>>> await Ticket.select(Round(Ticket.price) * 2)
[{'price': 100.0}]
Fixed some edge cases around defaults for Array
columns.
def get_default():
# This used to fail:
return [datetime.time(hour=8, minute=0)]
class MyTable(Table):
times = Array(Time(), default=get_default)
Fixed some deprecation warnings, and improved CockroachDB array tests.
1.8.0
Added the Cast
function, for performing type conversion.
Here's an example, where we convert a timestamp
to time
:
>>> from piccolo.columns import Time
>>> from piccolo.query.functions import Cast
>>> await Concert.select(Cast(Concert.starts, Time()))
[{'starts': datetime.time(19, 0)}]
A new section was also added to the docs describing functions in more detail.
1.7.0
Arrays of Date
/ Time
/ Timestamp
/ Timestamptz
now work in SQLite.
For example:
class MyTable(Table):
times = Array(Time())
dates = Array(Date())
timestamps = Array(Timestamp())
timestamps_tz = Array(Timestamptz())
1.6.0
Added support for a bunch of Postgres functions, like Upper
, Lower
, Length
, and Ltrim
. They can be used in select
queries:
from piccolo.query.functions.string import Upper
>>> await Band.select(Upper(Band.name, alias="name"))
[{"name": "PYTHONISTAS"}]
And also in where
clauses:
>>> await Band.select().where(Upper(Band.manager.name) == 'GUIDO')
[{"name": "Pythonistas"}]
1.5.2
Added an Album
table to the playground, along with some other improvements.
- 997 Fix type warnings in
playground/commands/run.py
by @dantownsend in #998 - 999 Add
Album
table to playground by @dantownsend in #1000
Fixed a bug with the output(load_json=True)
clause, when used on joined tables.
- 1001 Fix
load_json
on joined tables by @dantownsend in #1002
1.5.1
1.5.0
Lots of internal improvements, mostly to support new functionality in Piccolo Admin.
- docs: Update code example of prefetching related objects by @jrycw in #952
- 953 Add
array_columns
toTable._meta
by @dantownsend in #954 - 955 Add a method to the
Array
column for getting the number of dimensions of the array by @dantownsend in #956 - 962 Make it clearer how multiple
where
clauses work in the docs by @dantownsend in #963 - 964 Remove banner from docs saying about Piccolo v1 by @dantownsend in #965
- 966 Bump black version by @dantownsend in #967
- add a unique argument to the column extra by @sinisaos in #968
- 969 Add a utility method for getting the innermost type of an Array column by @dantownsend in #970
- update readme for Esmerald by @sinisaos in #972
New Contributors
Full Changelog: 1.4.2...1.5.0