url stringlengths 53 56 | repository_url stringclasses 1
value | labels_url stringlengths 67 70 | comments_url stringlengths 62 65 | events_url stringlengths 60 63 | html_url stringlengths 41 46 | id int64 450k 1.69B | node_id stringlengths 18 32 | number int64 1 2.72k | title stringlengths 1 209 | user dict | labels list | state stringclasses 1
value | locked bool 2
classes | assignee null | assignees list | milestone null | comments list | created_at timestamp[s] | updated_at timestamp[s] | closed_at timestamp[s] | author_association stringclasses 3
values | active_lock_reason stringclasses 2
values | body stringlengths 0 104k ⌀ | reactions dict | timeline_url stringlengths 62 65 | performed_via_github_app null | state_reason stringclasses 2
values | draft bool 2
classes | pull_request dict |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
https://api.github.com/repos/coleifer/peewee/issues/2418 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2418/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2418/comments | https://api.github.com/repos/coleifer/peewee/issues/2418/events | https://github.com/coleifer/peewee/issues/2418 | 899,949,749 | MDU6SXNzdWU4OTk5NDk3NDk= | 2,418 | Inner Select as Operation | {
"login": "josiahlaivins",
"id": 55600928,
"node_id": "MDQ6VXNlcjU1NjAwOTI4",
"avatar_url": "https://avatars.githubusercontent.com/u/55600928?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/josiahlaivins",
"html_url": "https://github.com/josiahlaivins",
"followers_url": "https://api.githu... | [] | closed | false | null | [] | null | [
"Not really, Peewee does not make an effort to support microsoft tsql.",
"@coleifer Thanks for the quick response! I understand that peewee doesnt support tsql. However I am making my own database object to support it. I thought I could just do a similar thing to the SQliteDatabase code. I appreciate any opinions... | 2021-05-24T19:39:57 | 2021-05-24T21:56:47 | 2021-05-24T20:59:34 | NONE | null | I am trying to setup a Azure SQL Db connector for peewee. Currently Model's use a local sqlite db for local storage/caching. I would like to connect to Azure SQL DB. I have found that this is not instantly straight forward:
When executing a `db.create_tables([table for table in classes if table not in db.get_tables(... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2418/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2418/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2417 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2417/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2417/comments | https://api.github.com/repos/coleifer/peewee/issues/2417/events | https://github.com/coleifer/peewee/issues/2417 | 897,688,382 | MDU6SXNzdWU4OTc2ODgzODI= | 2,417 | Value not getting stored? | {
"login": "Donkere-vader",
"id": 34307023,
"node_id": "MDQ6VXNlcjM0MzA3MDIz",
"avatar_url": "https://avatars.githubusercontent.com/u/34307023?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/Donkere-vader",
"html_url": "https://github.com/Donkere-vader",
"followers_url": "https://api.githu... | [] | closed | false | null | [] | null | [
"You're doing some very strange stuff with so many operator overloads and things, so it's hard to tell what is going on. Specifically, overriding getitem / setitem on model classes should probably be avoided.\r\n\r\nI'd suggest simplifying your code as much as possible to track this down, as I'm quite sure it's not... | 2021-05-21T05:23:12 | 2021-05-21T14:15:06 | 2021-05-21T12:40:58 | NONE | null | I'm not really sure if this is a bug or not. But it is very unexpected behavior.
So in my code I have two classes ``List`` and ``ListItem``.
```py
class Item(Model):
# snip
def set_value(self, value):
pass # snip
class ListItem(Item):
pass # snip
class List(Model):
# snip
... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2417/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2417/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2416 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2416/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2416/comments | https://api.github.com/repos/coleifer/peewee/issues/2416/events | https://github.com/coleifer/peewee/issues/2416 | 896,457,706 | MDU6SXNzdWU4OTY0NTc3MDY= | 2,416 | Is JSONPath for postgresql support planned? | {
"login": "DimaKalbfleysh",
"id": 39565365,
"node_id": "MDQ6VXNlcjM5NTY1MzY1",
"avatar_url": "https://avatars.githubusercontent.com/u/39565365?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/DimaKalbfleysh",
"html_url": "https://github.com/DimaKalbfleysh",
"followers_url": "https://api.gi... | [] | closed | false | null | [] | null | [
"There is some simple jsonpath support for the `__getitem__()`-type operations on jsonb fields. Because jsonpath is basically an entire language of its own, I've chosen not to implement some kind of python layer for now.\r\n\r\nYou can call the postgres jsonpath functions quite easily from peewee via `fn.jsonpath_X... | 2021-05-20T08:10:31 | 2021-05-20T13:02:53 | 2021-05-20T13:02:09 | NONE | null | Colleagues, good afternoon, JSONB has become an integral part of many projects. And I believe that many would like to see the implementation of this functionality (JSONPath) in peewee! | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2416/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2416/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2415 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2415/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2415/comments | https://api.github.com/repos/coleifer/peewee/issues/2415/events | https://github.com/coleifer/peewee/issues/2415 | 895,342,370 | MDU6SXNzdWU4OTUzNDIzNzA= | 2,415 | [question] Use query alias for group_by/order_by | {
"login": "atanasoff-yordan",
"id": 34780301,
"node_id": "MDQ6VXNlcjM0NzgwMzAx",
"avatar_url": "https://avatars.githubusercontent.com/u/34780301?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/atanasoff-yordan",
"html_url": "https://github.com/atanasoff-yordan",
"followers_url": "https://... | [] | closed | false | null | [] | null | [
"Peewee will do the right thing and use the alias if you write it this way:\r\n\r\n```python\r\nct = fn.COUNT(Tweet.id).alias('ct')\r\nquery = (User\r\n .select(User.username, ct)\r\n .join(Tweet, JOIN.LEFT_OUTER)\r\n .group_by(User.username)\r\n .order_by(ct))\r\n```\r\n\r\nProduces... | 2021-05-19T11:47:06 | 2021-05-19T12:38:48 | 2021-05-19T12:38:47 | NONE | null | As the documentation says [here](https://docs.peewee-orm.com/en/latest/peewee/querying.html#sorting-records) we should put the column on the order_by/group_by, for example, here the `.order_by(fn.COUNT(Tweet.id).desc())`
My question: since we defined an alias for the count, can we get a reference to that alias to use ... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2415/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2415/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2414 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2414/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2414/comments | https://api.github.com/repos/coleifer/peewee/issues/2414/events | https://github.com/coleifer/peewee/issues/2414 | 895,029,473 | MDU6SXNzdWU4OTUwMjk0NzM= | 2,414 | Conditional query of multiple in | {
"login": "xiaoqge",
"id": 8544686,
"node_id": "MDQ6VXNlcjg1NDQ2ODY=",
"avatar_url": "https://avatars.githubusercontent.com/u/8544686?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/xiaoqge",
"html_url": "https://github.com/xiaoqge",
"followers_url": "https://api.github.com/users/xiaoqge/... | [] | closed | false | null | [] | null | [
"Peewee supports multiple IN conditions:\r\n\r\n```python\r\n\r\n# postgres:\r\nin_list = ValuesList([(1, 'u1'), (2, 'u2'), (7, 'u7'), (8, 'u8')])\r\nquery = User.select().where(Tuple(User.id, User.username).in_(in_list))\r\n\r\n\r\n# note sqlite requires additional parentheses:\r\nfrom peewee import EnclosedNodeLi... | 2021-05-19T06:11:12 | 2021-05-20T02:07:21 | 2021-05-19T12:43:53 | NONE | null | Does peewee support multiple in query conditions? Can batch query if not supported?
```
pre_out = Txouts.select(Txouts.tx_id,Txouts.value,Txouts.scriptpubkey)\
.where(Txouts.tx_id==ins["prevout_tx_id"],Txouts.n==ins["prevout_n"]).dicts()
```
such as
```
SQL:
SELECT * from M
where
(... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2414/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2414/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2413 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2413/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2413/comments | https://api.github.com/repos/coleifer/peewee/issues/2413/events | https://github.com/coleifer/peewee/issues/2413 | 890,999,736 | MDU6SXNzdWU4OTA5OTk3MzY= | 2,413 | Unable to specify custom column name | {
"login": "alexin",
"id": 768281,
"node_id": "MDQ6VXNlcjc2ODI4MQ==",
"avatar_url": "https://avatars.githubusercontent.com/u/768281?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/alexin",
"html_url": "https://github.com/alexin",
"followers_url": "https://api.github.com/users/alexin/follow... | [] | closed | false | null | [] | null | [
"You have a trailing comma after your peewee.IntegerField() which is probably the issue.\r\n\r\nThis code works fine:\r\n\r\n```python\r\nclass Product(Model):\r\n reference = IntegerField(column_name='reference', primary_key=True)\r\n class Meta:\r\n database = db\r\n```\r\n\r\nProduces:\r\n\r\n```sql... | 2021-05-13T12:30:41 | 2021-05-13T12:55:44 | 2021-05-13T12:48:30 | NONE | null | Hello,
I am unable to set a custom column for a primary key.
For example, the following model
```python
class Product(peewee.Model):
reference = peewee.IntegerField(column_name='reference', primary_key=True),
```
results in the following SQL query
```sql
CREATE TABLE IF NOT EXISTS "product" ("id"... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2413/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2413/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2412 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2412/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2412/comments | https://api.github.com/repos/coleifer/peewee/issues/2412/events | https://github.com/coleifer/peewee/issues/2412 | 890,523,149 | MDU6SXNzdWU4OTA1MjMxNDk= | 2,412 | peewee.OperationalError: near "RETURNING": syntax error | {
"login": "bravegag",
"id": 4385408,
"node_id": "MDQ6VXNlcjQzODU0MDg=",
"avatar_url": "https://avatars.githubusercontent.com/u/4385408?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/bravegag",
"html_url": "https://github.com/bravegag",
"followers_url": "https://api.github.com/users/brave... | [] | closed | false | null | [] | null | [
"I found [this discussion](https://sqlite.org/forum/info/a4dde39b614ec0b2) and the issue is my version of sqlite3 3.29.0 which is lower than 3.35.x from where the RETURNING clause is supported :(.\r\n\r\nIs there another way to accomplish the same use-case without RETURNING?",
">Is there another way to accomplish... | 2021-05-12T22:05:20 | 2021-05-13T00:51:12 | 2021-05-13T00:50:42 | NONE | null | I'm on peewee 3.14.4 and sqlite, and I'm getting the above error `peewee.OperationalError: near "RETURNING": syntax error` for a simple insert_many query adapted to my context from exactly the same as stated in the docs i.e.
```
query = (User
.insert(email='foo@bar.com', created=fn.now())
.retur... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2412/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2412/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2411 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2411/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2411/comments | https://api.github.com/repos/coleifer/peewee/issues/2411/events | https://github.com/coleifer/peewee/issues/2411 | 890,448,083 | MDU6SXNzdWU4OTA0NDgwODM= | 2,411 | WHERE-IN query missing VALUES keyword leading to sqlite error | {
"login": "bravegag",
"id": 4385408,
"node_id": "MDQ6VXNlcjQzODU0MDg=",
"avatar_url": "https://avatars.githubusercontent.com/u/4385408?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/bravegag",
"html_url": "https://github.com/bravegag",
"followers_url": "https://api.github.com/users/brave... | [] | closed | false | null | [] | null | [
"Sqlite is finnicky about parentheses.\r\n\r\nThis should work:\r\n\r\n```python\r\n\r\nvl = ValuesList([('x1', 'y1'), ('x2', 'y2')])\r\n# wrap in extra parentheses for sqlite\r\nvl_p = EnclosedNodeList([vl])\r\n\r\nq = A.select().where(Tuple(A.a1, A.a2).in_(vl_p))\r\n```"
] | 2021-05-12T20:12:59 | 2021-05-12T21:21:30 | 2021-05-12T21:21:30 | NONE | null | I have the following use case in peewee version 3.14.4:
```
query = A.select().where(Tuple(A.a1, A.a2).in_([('x1', 'y1'), ('x2', 'y2')]))
print(query)
```
This will generate for sqlite a query similar to:
```
SELECT ...
FROM a
WHERE (a1, a2) IN (('x1', 'y1'), ('x2', 'y2'))
```
which leads to the sqlite... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2411/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2411/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2410 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2410/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2410/comments | https://api.github.com/repos/coleifer/peewee/issues/2410/events | https://github.com/coleifer/peewee/pull/2410 | 890,085,052 | MDExOlB1bGxSZXF1ZXN0NjQzMTU4NzQz | 2,410 | Use Python3 syntax for print | {
"login": "pylipp",
"id": 10617122,
"node_id": "MDQ6VXNlcjEwNjE3MTIy",
"avatar_url": "https://avatars.githubusercontent.com/u/10617122?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/pylipp",
"html_url": "https://github.com/pylipp",
"followers_url": "https://api.github.com/users/pylipp/fo... | [] | closed | false | null | [] | null | [] | 2021-05-12T13:21:24 | 2021-05-12T13:52:49 | 2021-05-12T13:52:49 | NONE | null | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2410/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2410/timeline | null | null | false | {
"url": "https://api.github.com/repos/coleifer/peewee/pulls/2410",
"html_url": "https://github.com/coleifer/peewee/pull/2410",
"diff_url": "https://github.com/coleifer/peewee/pull/2410.diff",
"patch_url": "https://github.com/coleifer/peewee/pull/2410.patch",
"merged_at": null
} | |
https://api.github.com/repos/coleifer/peewee/issues/2409 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2409/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2409/comments | https://api.github.com/repos/coleifer/peewee/issues/2409/events | https://github.com/coleifer/peewee/issues/2409 | 888,559,159 | MDU6SXNzdWU4ODg1NTkxNTk= | 2,409 | [Playhouse.migrator] Implement add_foreign_key_constraint or document solution for sqlite | {
"login": "thigg",
"id": 7593137,
"node_id": "MDQ6VXNlcjc1OTMxMzc=",
"avatar_url": "https://avatars.githubusercontent.com/u/7593137?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/thigg",
"html_url": "https://github.com/thigg",
"followers_url": "https://api.github.com/users/thigg/follower... | [] | closed | false | null | [] | null | [
"For reference: \r\n\r\nI solved it with this function:\r\n\r\n```python\r\ndef recreate_table(table: Type[Model], tablename: str):\r\n logger.info(\"copying table %s\", tablename)\r\n table_copy_name = tablename + \"_x\"\r\n col_names = \",\".join(col.name for col in db.get_columns(tablename))\r\n db.e... | 2021-05-11T20:36:15 | 2021-05-12T12:55:01 | 2021-05-12T12:53:46 | NONE | null | `add_foreign_key_constraint` for the sqlite migrator throws a NotImplemented error.
A possible solution would be to rename the table, recreate the table, copy the data, drop the copy. (as described in https://www.techonthenet.com/sqlite/foreign_keys/foreign_delete.php)
This could either be implemented or at least... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2409/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2409/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2408 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2408/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2408/comments | https://api.github.com/repos/coleifer/peewee/issues/2408/events | https://github.com/coleifer/peewee/pull/2408 | 887,635,063 | MDExOlB1bGxSZXF1ZXN0NjQwODU0Mzc2 | 2,408 | Insert operations of models with non-PK foreign keys fail when passing a target object instance | {
"login": "smuething",
"id": 1837881,
"node_id": "MDQ6VXNlcjE4Mzc4ODE=",
"avatar_url": "https://avatars.githubusercontent.com/u/1837881?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/smuething",
"html_url": "https://github.com/smuething",
"followers_url": "https://api.github.com/users/sm... | [] | closed | false | null | [] | null | [] | 2021-05-11T15:27:09 | 2021-05-11T19:08:55 | 2021-05-11T19:08:55 | NONE | null | I have a model `A` with a `ForeignKeyField` column that uses the `field` parameter to set a non-pk reference column in the target model:
```python
class Target(Model):
key = FixedCharField(8,unique=True)
class A(Model):
target = ForeignKeyField(Target,field="key",lazy_load=False)
```
When trying to... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2408/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2408/timeline | null | null | false | {
"url": "https://api.github.com/repos/coleifer/peewee/pulls/2408",
"html_url": "https://github.com/coleifer/peewee/pull/2408",
"diff_url": "https://github.com/coleifer/peewee/pull/2408.diff",
"patch_url": "https://github.com/coleifer/peewee/pull/2408.patch",
"merged_at": null
} |
https://api.github.com/repos/coleifer/peewee/issues/2407 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2407/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2407/comments | https://api.github.com/repos/coleifer/peewee/issues/2407/events | https://github.com/coleifer/peewee/pull/2407 | 885,554,528 | MDExOlB1bGxSZXF1ZXN0NjM4ODczODMx | 2,407 | [Feature] Add support for the precision parameters to the FLOAT field | {
"login": "enpaul",
"id": 24588726,
"node_id": "MDQ6VXNlcjI0NTg4NzI2",
"avatar_url": "https://avatars.githubusercontent.com/u/24588726?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/enpaul",
"html_url": "https://github.com/enpaul",
"followers_url": "https://api.github.com/users/enpaul/fo... | [] | closed | false | null | [] | null | [
"Ehh, I'm going to pass on this, as I think it could be misleading. This is a mysql-only thing, as far as I know, and the data is still stored as a floating-point (e.g. approximate) value anyways. If you want to specify a precision then you would really want to use the DecimalField (numeric type).\r\n\r\nI'd sugges... | 2021-05-11T01:20:42 | 2021-05-12T20:24:24 | 2021-05-11T12:51:03 | NONE | null | Hello, thank you so much for creating and maintaining this library! Peewee has been my go-to for several years now, both at work and on personal projects and it's honestly been a joy to use.
Recently I encountered a situation where I needed to specify the [precision parameters](https://dev.mysql.com/doc/refman/8.0/e... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2407/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2407/timeline | null | null | false | {
"url": "https://api.github.com/repos/coleifer/peewee/pulls/2407",
"html_url": "https://github.com/coleifer/peewee/pull/2407",
"diff_url": "https://github.com/coleifer/peewee/pull/2407.diff",
"patch_url": "https://github.com/coleifer/peewee/pull/2407.patch",
"merged_at": null
} |
https://api.github.com/repos/coleifer/peewee/issues/2406 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2406/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2406/comments | https://api.github.com/repos/coleifer/peewee/issues/2406/events | https://github.com/coleifer/peewee/issues/2406 | 880,338,673 | MDU6SXNzdWU4ODAzMzg2NzM= | 2,406 | LSMTable.get_by_id raises KeyError which breaks __contains__ functionality on ModelBase | {
"login": "vdksoda",
"id": 12879372,
"node_id": "MDQ6VXNlcjEyODc5Mzcy",
"avatar_url": "https://avatars.githubusercontent.com/u/12879372?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/vdksoda",
"html_url": "https://github.com/vdksoda",
"followers_url": "https://api.github.com/users/vdksod... | [] | closed | false | null | [] | null | [
"You bring up a good point about having this be consistent with other models. I've removed the code which was raising the `KeyError` and updated the docs as well. It should behave the same as regular models now."
] | 2021-05-08T05:55:21 | 2021-05-08T14:48:12 | 2021-05-08T14:47:40 | NONE | null | I have a scenario where I need to test for the presence of a key in a `LSMTable`. I noticed that `ModelBase` does support a `__contains__` method. So decided to do something like:
```
app_db = PooledSqliteExtDatabase(
database=sqlite_db_filename,
max_connections=500,
pragmas=[
... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2406/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2406/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2405 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2405/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2405/comments | https://api.github.com/repos/coleifer/peewee/issues/2405/events | https://github.com/coleifer/peewee/issues/2405 | 878,832,736 | MDU6SXNzdWU4Nzg4MzI3MzY= | 2,405 | PostgreSQL Autoreconnect / migrations | {
"login": "konradkur",
"id": 22791650,
"node_id": "MDQ6VXNlcjIyNzkxNjUw",
"avatar_url": "https://avatars.githubusercontent.com/u/22791650?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/konradkur",
"html_url": "https://github.com/konradkur",
"followers_url": "https://api.github.com/users/... | [] | closed | false | null | [] | null | [
"Automatic reconnect can be done with the help of the `playhouse.shortcuts.ReconnectMixin`, but you will definitely need to modify the `reconnect_errors` attribute so that it corresponds to Postgres-specific error conditions. The reconnect mixin should not be used with Postgres unless you REALLY know what you are d... | 2021-05-07T11:35:40 | 2021-05-07T13:22:13 | 2021-05-07T13:22:13 | NONE | null | Hello guys,
i try find solutions for postgresql autoreconnect, any ideas?
next question, the best migration system for peewee it?
thanks,
Konrad | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2405/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2405/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2404 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2404/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2404/comments | https://api.github.com/repos/coleifer/peewee/issues/2404/events | https://github.com/coleifer/peewee/issues/2404 | 878,560,665 | MDU6SXNzdWU4Nzg1NjA2NjU= | 2,404 | The problem of storing timestamps | {
"login": "xiaoqge",
"id": 8544686,
"node_id": "MDQ6VXNlcjg1NDQ2ODY=",
"avatar_url": "https://avatars.githubusercontent.com/u/8544686?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/xiaoqge",
"html_url": "https://github.com/xiaoqge",
"followers_url": "https://api.github.com/users/xiaoqge/... | [] | closed | false | null | [] | null | [] | 2021-05-07T07:37:21 | 2021-05-07T08:01:43 | 2021-05-07T08:01:43 | NONE | null | Hello, can't the DateTimeField field store a timestamp without a time zone? Thank you very much for your help every time
```
from peewee import *
db = PostgresqlDatabase('peewee_test',user='postgres',host="10.10.17.2",password='111')
#db2 = PostgresqlDatabase('peewee_test',user='postgres',host="10.10.17.2",pass... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2404/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2404/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2403 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2403/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2403/comments | https://api.github.com/repos/coleifer/peewee/issues/2403/events | https://github.com/coleifer/peewee/issues/2403 | 877,681,739 | MDU6SXNzdWU4Nzc2ODE3Mzk= | 2,403 | About the postgresql update problem | {
"login": "xiaoqge",
"id": 8544686,
"node_id": "MDQ6VXNlcjg1NDQ2ODY=",
"avatar_url": "https://avatars.githubusercontent.com/u/8544686?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/xiaoqge",
"html_url": "https://github.com/xiaoqge",
"followers_url": "https://api.github.com/users/xiaoqge/... | [] | closed | false | null | [] | null | [
"Ah, I see the problem.\r\n\r\nWhen Postgresql runs into an IntegrityError (the exception that occurs when you violate the unique constraint, e.g.) then you *have* to rollback the transaction. The connection gets into a bad state and no further queries can be run until you rollback. The problem is you have started ... | 2021-05-06T16:15:31 | 2021-05-06T20:25:18 | 2021-05-06T20:24:30 | NONE | null | I am using pgsql 13.2, I tried to execute the following code, and I commented the commit, but an error occurred after executing the update, may I ask where the problem is, thank you very much
```
from peewee import *
db = PostgresqlDatabase('peewee_test',user='postgres',host="10.10.17.2",password='11')
db2 = Post... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2403/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2403/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2402 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2402/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2402/comments | https://api.github.com/repos/coleifer/peewee/issues/2402/events | https://github.com/coleifer/peewee/issues/2402 | 877,539,688 | MDU6SXNzdWU4Nzc1Mzk2ODg= | 2,402 | Postgresql transaction problem | {
"login": "xiaoqge",
"id": 8544686,
"node_id": "MDQ6VXNlcjg1NDQ2ODY=",
"avatar_url": "https://avatars.githubusercontent.com/u/8544686?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/xiaoqge",
"html_url": "https://github.com/xiaoqge",
"followers_url": "https://api.github.com/users/xiaoqge/... | [] | closed | false | null | [] | null | [] | 2021-05-06T14:08:51 | 2021-05-06T14:30:36 | 2021-05-06T14:30:35 | NONE | null | In the code below, I commented the commit, but it can still be written to the database. I hope to write to the database after the commit. I used mysql before, but it is not normal to migrate to Postgresql. Could you please tell me where do I do this? is it wrong? thank you very much for your help
```
... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2402/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2402/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2401 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2401/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2401/comments | https://api.github.com/repos/coleifer/peewee/issues/2401/events | https://github.com/coleifer/peewee/issues/2401 | 875,083,573 | MDU6SXNzdWU4NzUwODM1NzM= | 2,401 | FastAPI Framework Integration section (seems it) has incorrect information | {
"login": "gondolio",
"id": 4338344,
"node_id": "MDQ6VXNlcjQzMzgzNDQ=",
"avatar_url": "https://avatars.githubusercontent.com/u/4338344?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/gondolio",
"html_url": "https://github.com/gondolio",
"followers_url": "https://api.github.com/users/gondo... | [] | closed | false | null | [] | null | [
"I'm not sure what the correct replacement is, but here is the Peewee page in FastAPI:\r\nhttps://fastapi.tiangolo.com/advanced/sql-databases-peewee/",
"I'm not familiar with FastAPI, that section was contributed. Since its async I assume that it is, in fact, rather complicated to use Peewee correctly with it. Yo... | 2021-05-04T04:06:13 | 2022-02-09T15:38:31 | 2021-05-04T12:48:01 | NONE | null | In the [documentation](http://docs.peewee-orm.com/en/latest/peewee/database.html#framework-integration), it says
> We’ll open the connection when a request is received, then close it when the response is returned.
and it does this using "startup" and "shutdown" events.
But if you look at the FastAPI [document... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2401/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2401/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2400 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2400/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2400/comments | https://api.github.com/repos/coleifer/peewee/issues/2400/events | https://github.com/coleifer/peewee/issues/2400 | 874,917,846 | MDU6SXNzdWU4NzQ5MTc4NDY= | 2,400 | Free memory from cache? | {
"login": "SamNPowers",
"id": 881718,
"node_id": "MDQ6VXNlcjg4MTcxOA==",
"avatar_url": "https://avatars.githubusercontent.com/u/881718?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/SamNPowers",
"html_url": "https://github.com/SamNPowers",
"followers_url": "https://api.github.com/users/S... | [] | closed | false | null | [] | null | [
"Unfortunately, besides `.iterator()` the only other thing you might do would be to explicitly `.select()` all columns except for the large one. You could then implement a property/accessor to load the large column on-demand.\r\n\r\n```python\r\n\r\nclass Post(Model):\r\n title = TextField()\r\n _attachment =... | 2021-05-03T21:17:27 | 2021-05-07T05:41:04 | 2021-05-03T21:52:00 | NONE | null | Hi, thanks for the great repo.
I have a db Model with one very large field on it that I don't need to access very often. I would like to be able to load it in, then remove it from cache after I'm done with it, to free the RAM for other things. I saw that iterator() exists, but it doesn't quite fit my use case. Could... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2400/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2400/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2399 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2399/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2399/comments | https://api.github.com/repos/coleifer/peewee/issues/2399/events | https://github.com/coleifer/peewee/issues/2399 | 874,743,598 | MDU6SXNzdWU4NzQ3NDM1OTg= | 2,399 | DataSet "peewee.OperationalError: duplicate column name" raised when unique column name with different case is present in thawed CSV file | {
"login": "ldconejo",
"id": 5453372,
"node_id": "MDQ6VXNlcjU0NTMzNzI=",
"avatar_url": "https://avatars.githubusercontent.com/u/5453372?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/ldconejo",
"html_url": "https://github.com/ldconejo",
"followers_url": "https://api.github.com/users/ldcon... | [] | closed | false | null | [] | null | [
"I don't necessarily agree that this needs to be fixed by Peewee -- presumably you can sanitize or normalize this data."
] | 2021-05-03T17:01:33 | 2021-05-06T15:43:24 | 2021-05-06T15:43:24 | NONE | null | Issue originally reported by @bromleysj
Running peewee-3.14.1 on Python 3.9.
Consider the following example:
```
# demo.py
from playhouse.dataset import DataSet
database = "test.db"
database = DataSet(f"sqlite:///{database}")
users = database["Users"]
users.insert(user_id="test")
users.create_inde... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2399/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2399/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2398 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2398/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2398/comments | https://api.github.com/repos/coleifer/peewee/issues/2398/events | https://github.com/coleifer/peewee/issues/2398 | 873,860,629 | MDU6SXNzdWU4NzM4NjA2Mjk= | 2,398 | How can I split the table in Peewee? | {
"login": "nic519",
"id": 2610741,
"node_id": "MDQ6VXNlcjI2MTA3NDE=",
"avatar_url": "https://avatars.githubusercontent.com/u/2610741?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/nic519",
"html_url": "https://github.com/nic519",
"followers_url": "https://api.github.com/users/nic519/foll... | [] | closed | false | null | [] | null | [
"You're going to have a hard time, basically.\r\n\r\nYou might create a VIEW or something that unions together all these tables, and just select from that view for read-only queries.\r\n\r\nFor writing you will need to either\r\n\r\n1. change the `table_name` at runtime (`db_table` is deprecated, it has been rename... | 2021-05-02T06:10:29 | 2021-05-02T17:28:19 | 2021-05-02T17:28:19 | NONE | null | ```
class User(Model):
id = IntegerField()
name = CharField()
Class Meta:
database = db # db connection
db_table = 'user_00' # Here is the problem
```
We have a lot of users, and I have to split the table like user_00,user_01,user_0...user_09.
If I use the field db_table, I ca... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2398/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2398/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2397 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2397/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2397/comments | https://api.github.com/repos/coleifer/peewee/issues/2397/events | https://github.com/coleifer/peewee/pull/2397 | 873,075,143 | MDExOlB1bGxSZXF1ZXN0NjI3OTI0MjUz | 2,397 | Added two special expressions, for BooleanField | {
"login": "daveusa31",
"id": 81916132,
"node_id": "MDQ6VXNlcjgxOTE2MTMy",
"avatar_url": "https://avatars.githubusercontent.com/u/81916132?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/daveusa31",
"html_url": "https://github.com/daveusa31",
"followers_url": "https://api.github.com/users/... | [] | closed | false | null | [] | null | [
"You don't even need `.is_true()` honestly, you can just:\r\n\r\n```python\r\n.where(User.is_activated)\r\n```\r\n\r\nOr for false:\r\n\r\n```python\r\n.where(~User.is_activated)\r\n```\r\n\r\nGoing to pass on this change."
] | 2021-04-30T18:46:01 | 2021-04-30T19:04:42 | 2021-04-30T19:04:01 | NONE | null | To write queries like this,
```python
User.select().where(User.is_activated.is_true())
```
And not like this
```python
User.select().where(User.is_activated == True)
```
| {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2397/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2397/timeline | null | null | false | {
"url": "https://api.github.com/repos/coleifer/peewee/pulls/2397",
"html_url": "https://github.com/coleifer/peewee/pull/2397",
"diff_url": "https://github.com/coleifer/peewee/pull/2397.diff",
"patch_url": "https://github.com/coleifer/peewee/pull/2397.patch",
"merged_at": null
} |
https://api.github.com/repos/coleifer/peewee/issues/2396 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2396/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2396/comments | https://api.github.com/repos/coleifer/peewee/issues/2396/events | https://github.com/coleifer/peewee/issues/2396 | 867,122,756 | MDU6SXNzdWU4NjcxMjI3NTY= | 2,396 | Identity Map and Unit of Work Question | {
"login": "mkmoisen",
"id": 2534631,
"node_id": "MDQ6VXNlcjI1MzQ2MzE=",
"avatar_url": "https://avatars.githubusercontent.com/u/2534631?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/mkmoisen",
"html_url": "https://github.com/mkmoisen",
"followers_url": "https://api.github.com/users/mkmoi... | [] | closed | false | null | [] | null | [
"I dislike identity map and unit of work because they hide too much from the user and require some concept of a \"session\". Are sessions transactions? Connection lifetimes? Are they thread-safe? What kind of error-handling do they provide? Etc.\r\n\r\nI find it easier to think in terms of the abstractions provided... | 2021-04-25T21:50:43 | 2021-04-26T15:20:09 | 2021-04-26T00:17:00 | NONE | null | This is not a bug/issue, rather a design question.
I've spent quite a lot of time reading about the Active Record vs Identity Map/Unit of Work debates, and it seems like the general consensus is that Identity Map/Unit of Work is a good thing, and superior to Active Record.
However, I fundamentally do not understa... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2396/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2396/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2395 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2395/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2395/comments | https://api.github.com/repos/coleifer/peewee/issues/2395/events | https://github.com/coleifer/peewee/issues/2395 | 863,436,433 | MDU6SXNzdWU4NjM0MzY0MzM= | 2,395 | Postgresql support TimescaleDB ? | {
"login": "xiaoqge",
"id": 8544686,
"node_id": "MDQ6VXNlcjg1NDQ2ODY=",
"avatar_url": "https://avatars.githubusercontent.com/u/8544686?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/xiaoqge",
"html_url": "https://github.com/xiaoqge",
"followers_url": "https://api.github.com/users/xiaoqge/... | [] | closed | false | null | [] | null | [
"I don't know anything about TimescaleDB. Peewee supports anything that speaks the postgres protocol via the psycopg2 driver. If psycopg2 supports it, then its likely supported in peewee."
] | 2021-04-21T04:28:25 | 2021-04-24T17:12:17 | 2021-04-24T17:12:17 | NONE | null | Hello, does Postgresql support the extension of TimescaleDB? | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2395/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2395/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2394 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2394/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2394/comments | https://api.github.com/repos/coleifer/peewee/issues/2394/events | https://github.com/coleifer/peewee/issues/2394 | 862,563,007 | MDU6SXNzdWU4NjI1NjMwMDc= | 2,394 | Control result iterator in prefetch | {
"login": "surajrav",
"id": 8673958,
"node_id": "MDQ6VXNlcjg2NzM5NTg=",
"avatar_url": "https://avatars.githubusercontent.com/u/8673958?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/surajrav",
"html_url": "https://github.com/surajrav",
"followers_url": "https://api.github.com/users/suraj... | [] | closed | false | null | [] | null | [
"Prefetch is not designed as a replacement for serialization - it is to help reduce queries in certain cases. The complexity of mapping relations back to instances precludes providing different result-types (like dicts or tuples) -- so models are always returned. Any additional processing can then work on the model... | 2021-04-20T08:29:12 | 2021-04-20T13:50:41 | 2021-04-20T13:50:41 | NONE | null | Hi, I would like to know if there is a way to specify the iterator per row in a prefetch query.
Ideally, I would like to add a `.dicts()` to the end of my prefetch query along with specifying which fields to add to the dict that may not be in the base queries select.
*Current Model and Query Setup*
The scenar... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2394/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2394/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2393 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2393/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2393/comments | https://api.github.com/repos/coleifer/peewee/issues/2393/events | https://github.com/coleifer/peewee/issues/2393 | 861,114,230 | MDU6SXNzdWU4NjExMTQyMzA= | 2,393 | bulk_create does not work with bulk created foreignkey | {
"login": "elya5",
"id": 4464481,
"node_id": "MDQ6VXNlcjQ0NjQ0ODE=",
"avatar_url": "https://avatars.githubusercontent.com/u/4464481?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/elya5",
"html_url": "https://github.com/elya5",
"followers_url": "https://api.github.com/users/elya5/follower... | [] | closed | false | null | [] | null | [
"The bulk create API doesn't set the fk value automatically.\r\n\r\nJust wrap it in a transaction and it will be plenty fast."
] | 2021-04-19T09:40:43 | 2021-04-19T12:57:28 | 2021-04-19T12:57:28 | NONE | null | Hi,
I have the following models:
```
class WWW(Model):
mdate = CharField(null=True)
key = CharField(null=True)
title = CharField(null=True)
url = CharField(null=True)
class Meta:
database = d
class AuthorField(Model):
name = CharField()
www = ForeignKeyField(WWW, ba... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2393/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2393/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2392 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2392/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2392/comments | https://api.github.com/repos/coleifer/peewee/issues/2392/events | https://github.com/coleifer/peewee/issues/2392 | 860,869,660 | MDU6SXNzdWU4NjA4Njk2NjA= | 2,392 | Passing max_length to CharField when used in ArrayField | {
"login": "TimothyBramlett",
"id": 7890441,
"node_id": "MDQ6VXNlcjc4OTA0NDE=",
"avatar_url": "https://avatars.githubusercontent.com/u/7890441?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/TimothyBramlett",
"html_url": "https://github.com/TimothyBramlett",
"followers_url": "https://api.g... | [] | closed | false | null | [] | null | [
"Please post questions to stackoverflow.\r\n\r\n```python\r\nsome_field = ArrayField(CharField, field_kwargs={'max_length': 20}, null=True)\r\n```\r\n\r\nhttp://docs.peewee-orm.com/en/latest/peewee/playhouse.html#ArrayField"
] | 2021-04-19T03:54:39 | 2021-04-19T12:51:12 | 2021-04-19T12:51:12 | NONE | null | How would I pass max_length here:
```
some_field = ArrayField(peewee.CharField(max_length=20), null=True)
```
When I try to do that I get:
```
TypeError: 'CharField' object is not callable
``` | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2392/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2392/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2391 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2391/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2391/comments | https://api.github.com/repos/coleifer/peewee/issues/2391/events | https://github.com/coleifer/peewee/pull/2391 | 860,154,238 | MDExOlB1bGxSZXF1ZXN0NjE3MTA5MzA2 | 2,391 | Add ability to create an instance from a back reference | {
"login": "mikemill",
"id": 1652125,
"node_id": "MDQ6VXNlcjE2NTIxMjU=",
"avatar_url": "https://avatars.githubusercontent.com/u/1652125?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/mikemill",
"html_url": "https://github.com/mikemill",
"followers_url": "https://api.github.com/users/mikem... | [] | closed | false | null | [] | null | [
"The patch looks fine, but I have tried to stay away from that particular pandora's box. In the simple case it's straightforward, but it breaks the backref abstraction a bit, and there are just a few too many edge-cases. I prefer to keep it as a naive/simple `Select`.\r\n\r\nIf you really want this in your own app,... | 2021-04-16T20:40:14 | 2021-04-17T01:45:00 | 2021-04-16T23:43:17 | NONE | null | Allow an instance of a model to be created using the back reference. For example, if I have a `User` and I want to create a `Tweet` for that user then allow it to be used as `user.tweets.create()`.
On a practical level this helps a lot when there are logs associated with a user or similar object. Compare the above... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2391/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2391/timeline | null | null | false | {
"url": "https://api.github.com/repos/coleifer/peewee/pulls/2391",
"html_url": "https://github.com/coleifer/peewee/pull/2391",
"diff_url": "https://github.com/coleifer/peewee/pull/2391.diff",
"patch_url": "https://github.com/coleifer/peewee/pull/2391.patch",
"merged_at": null
} |
https://api.github.com/repos/coleifer/peewee/issues/2390 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2390/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2390/comments | https://api.github.com/repos/coleifer/peewee/issues/2390/events | https://github.com/coleifer/peewee/issues/2390 | 857,282,042 | MDU6SXNzdWU4NTcyODIwNDI= | 2,390 | "can't set attribute" using "Recursive CTEs" on Nuke Python | {
"login": "websterek",
"id": 40537787,
"node_id": "MDQ6VXNlcjQwNTM3Nzg3",
"avatar_url": "https://avatars.githubusercontent.com/u/40537787?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/websterek",
"html_url": "https://github.com/websterek",
"followers_url": "https://api.github.com/users/... | [] | closed | false | null | [] | null | [
"The code you've highlighted is setting attributes dynamically onto an object, and this is a fairly fundamental thing to Peewee's operation. Possibly this is being prevented because these attributes correspond with the field instances declared on the model class? At any rate, this seems to be something you should b... | 2021-04-13T20:05:23 | 2021-04-13T21:27:42 | 2021-04-13T21:27:42 | NONE | null | Hi!
I have problem will running peewee using Python built into Nuke software:
```
Python version
2.7.16 (v2.7.16-dirty:413a49145e, Aug 6 2019, 14:37:13) [MSC v.1913 64 bit (AMD64)]
Version info.
sys.version_info(major=2, minor=7, micro=16, releaselevel='final', serial=0)
```
In "normal" Python installation eve... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2390/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2390/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2389 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2389/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2389/comments | https://api.github.com/repos/coleifer/peewee/issues/2389/events | https://github.com/coleifer/peewee/issues/2389 | 852,394,196 | MDU6SXNzdWU4NTIzOTQxOTY= | 2,389 | Connection Error - peewee.InterfaceError: (0, '') | {
"login": "NeroNekro",
"id": 36452325,
"node_id": "MDQ6VXNlcjM2NDUyMzI1",
"avatar_url": "https://avatars.githubusercontent.com/u/36452325?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/NeroNekro",
"html_url": "https://github.com/NeroNekro",
"followers_url": "https://api.github.com/users/... | [] | closed | false | null | [] | null | [
"Sorry, I'm not familiar with fastapi but presumably it's something to do with sharing connections across threads or processes or some other asyncio-related issue."
] | 2021-04-07T13:10:46 | 2021-04-07T13:26:49 | 2021-04-07T13:26:49 | NONE | null | Hi,
I using FastAPI with Peewee and PyMySQL and get the following Error:
`[2021-04-07 09:56:38 +0000] [729] [ERROR] Exception in ASGI application
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/uvicorn/protocols/http/httptools_impl.py", line 398, in run_asgi
result = await... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2389/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2389/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2388 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2388/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2388/comments | https://api.github.com/repos/coleifer/peewee/issues/2388/events | https://github.com/coleifer/peewee/issues/2388 | 851,191,239 | MDU6SXNzdWU4NTExOTEyMzk= | 2,388 | Thread-safe use of CSqliteExtDatabase update hooks | {
"login": "rokel",
"id": 6145874,
"node_id": "MDQ6VXNlcjYxNDU4NzQ=",
"avatar_url": "https://avatars.githubusercontent.com/u/6145874?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/rokel",
"html_url": "https://github.com/rokel",
"followers_url": "https://api.github.com/users/rokel/follower... | [] | closed | false | null | [] | null | [
"So first of all: by default peewee stores connection state in a threadlocal. This means each thread has its own connection. Hooks are specific to the connection they are registered on -- peewee takes care of registering them, but just fyi that's how it works.\r\n\r\nSecond of all: sqlite cannot accept writes from ... | 2021-04-06T08:40:37 | 2021-04-06T18:41:35 | 2021-04-06T13:35:08 | NONE | null | #### Summary
The SQLite hooks like `on_update`, `on_commit` are really useful, thank you for exposing them (and thank you for a fantastic lib!).
But I'm not sure how to use the hooks in a multithreaded program. I have a threadpool of workers servicing a gRPC API that I want to give concurrent read access to a SQL... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2388/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2388/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2387 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2387/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2387/comments | https://api.github.com/repos/coleifer/peewee/issues/2387/events | https://github.com/coleifer/peewee/issues/2387 | 850,402,358 | MDU6SXNzdWU4NTA0MDIzNTg= | 2,387 | Connections fail with: peewee.OperationalError: (1524, "Plugin 'unix_socket' is not loaded") | {
"login": "scjoiner",
"id": 4303855,
"node_id": "MDQ6VXNlcjQzMDM4NTU=",
"avatar_url": "https://avatars.githubusercontent.com/u/4303855?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/scjoiner",
"html_url": "https://github.com/scjoiner",
"followers_url": "https://api.github.com/users/scjoi... | [] | closed | false | null | [] | null | [
"Sounds like an issue in your db driver. That error is being propagated up from whatever driver you're using. Presumably you upgraded something else in addition to just peewee. You can diff the last working version with 3.14.4 and see if anything jumps out at you, but it seems unlikely to me."
] | 2021-04-05T14:22:46 | 2021-04-05T21:29:53 | 2021-04-05T21:29:53 | NONE | null | In Peewee 3.14.4 connections are failing with the error message "peewee.OperationalError: (1524, "Plugin 'unix_socket' is not loaded")" on the db.connect() command.
OS is Ubuntu 18.04 running Python 3.6 in a virtual environment for a Flask application with uwsgi.
This application was previously working and this... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2387/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2387/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2386 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2386/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2386/comments | https://api.github.com/repos/coleifer/peewee/issues/2386/events | https://github.com/coleifer/peewee/issues/2386 | 850,235,617 | MDU6SXNzdWU4NTAyMzU2MTc= | 2,386 | model_to_dict exclude | {
"login": "bronte2k7",
"id": 29693866,
"node_id": "MDQ6VXNlcjI5NjkzODY2",
"avatar_url": "https://avatars.githubusercontent.com/u/29693866?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/bronte2k7",
"html_url": "https://github.com/bronte2k7",
"followers_url": "https://api.github.com/users/... | [] | closed | false | null | [] | null | [
"http://docs.peewee-orm.com/en/latest/peewee/playhouse.html#model_to_dict\r\n\r\n>exclude – A list (or set) of field instances which should be excluded from the result dictionary.\r\n\r\nYou need to pass the field instance.",
"I do not understand something. Please show me an example. I have already tried it in di... | 2021-04-05T09:32:04 | 2022-09-24T13:26:51 | 2021-04-05T23:35:37 | NONE | null | Hi
```python
class Account(Model):
email = CharField(max_length=255, unique=True, index=True)
password = PasswordField(index=True)
account = Account.get_or_none(Accountl.id == 1)
account = model_to_dict(account, exclude=['password'])
```
Password is not excluded
| {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2386/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2386/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2385 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2385/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2385/comments | https://api.github.com/repos/coleifer/peewee/issues/2385/events | https://github.com/coleifer/peewee/issues/2385 | 849,750,736 | MDU6SXNzdWU4NDk3NTA3MzY= | 2,385 | contrib a DillField ? | {
"login": "aiqc",
"id": 74990642,
"node_id": "MDQ6VXNlcjc0OTkwNjQy",
"avatar_url": "https://avatars.githubusercontent.com/u/74990642?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/aiqc",
"html_url": "https://github.com/aiqc",
"followers_url": "https://api.github.com/users/aiqc/followers"... | [] | closed | false | null | [] | null | [
"`playhouse.fields`\r\nhttps://github.com/coleifer/peewee/blob/a8938588c00ae7ef94f453b8873820419474b4ce/playhouse/fields.py\r\n\r\n`tests.extra_fields`\r\nhttps://github.com/coleifer/peewee/blob/a8938588c00ae7ef94f453b8873820419474b4ce/playhouse/fields.py\r\n",
"You're welcome to package this up as your own exten... | 2021-04-03T22:20:13 | 2021-04-04T01:13:23 | 2021-04-04T01:13:23 | NONE | null | I've been using the `PickleField` a lot, but ran into Pickle's limitations. These are overcome by `dill`, which was written by the `pathos` people.
https://dill.readthedocs.io/en/latest/#major-features
At first, I thought I would just save my dill-serialized objects as bytes in the `BlobField()`, but then then I re... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2385/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2385/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2384 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2384/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2384/comments | https://api.github.com/repos/coleifer/peewee/issues/2384/events | https://github.com/coleifer/peewee/pull/2384 | 849,599,993 | MDExOlB1bGxSZXF1ZXN0NjA4MzQ1MjAy | 2,384 | Fix reference to `first` method | {
"login": "Helveg",
"id": 28923979,
"node_id": "MDQ6VXNlcjI4OTIzOTc5",
"avatar_url": "https://avatars.githubusercontent.com/u/28923979?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/Helveg",
"html_url": "https://github.com/Helveg",
"followers_url": "https://api.github.com/users/Helveg/fo... | [] | closed | false | null | [] | null | [
"Eh I'll need to look into this some more - not urgent."
] | 2021-04-03T07:22:47 | 2021-04-03T17:41:35 | 2021-04-03T17:41:35 | NONE | null | Not sure that this is the right class but it closes #2383 | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2384/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2384/timeline | null | null | false | {
"url": "https://api.github.com/repos/coleifer/peewee/pulls/2384",
"html_url": "https://github.com/coleifer/peewee/pull/2384",
"diff_url": "https://github.com/coleifer/peewee/pull/2384.diff",
"patch_url": "https://github.com/coleifer/peewee/pull/2384.patch",
"merged_at": null
} |
https://api.github.com/repos/coleifer/peewee/issues/2383 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2383/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2383/comments | https://api.github.com/repos/coleifer/peewee/issues/2383/events | https://github.com/coleifer/peewee/issues/2383 | 849,599,597 | MDU6SXNzdWU4NDk1OTk1OTc= | 2,383 | `Model.first()` doc reference broken | {
"login": "Helveg",
"id": 28923979,
"node_id": "MDQ6VXNlcjI4OTIzOTc5",
"avatar_url": "https://avatars.githubusercontent.com/u/28923979?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/Helveg",
"html_url": "https://github.com/Helveg",
"followers_url": "https://api.github.com/users/Helveg/fo... | [] | closed | false | null | [] | null | [] | 2021-04-03T07:20:11 | 2021-04-03T17:41:28 | 2021-04-03T17:41:28 | NONE | null | In the docs under [Selecting a single record](https://github.com/coleifer/peewee/blob/master/docs/peewee/querying.rst#selecting-a-single-record) there is a broken link to `Model.first`. Using it yields an attribute error that `first` doesn't exist on my model. I fixed this by using `Model.select().first()` and most lik... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2383/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2383/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2382 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2382/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2382/comments | https://api.github.com/repos/coleifer/peewee/issues/2382/events | https://github.com/coleifer/peewee/pull/2382 | 848,881,500 | MDExOlB1bGxSZXF1ZXN0NjA3NzQ4NTM3 | 2,382 | Add ModelSelect.get_or_none() | {
"login": "ilyakamens",
"id": 3293811,
"node_id": "MDQ6VXNlcjMyOTM4MTE=",
"avatar_url": "https://avatars.githubusercontent.com/u/3293811?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/ilyakamens",
"html_url": "https://github.com/ilyakamens",
"followers_url": "https://api.github.com/users... | [] | closed | false | null | [] | null | [
"Thanks for the patch, looks good and merged."
] | 2021-04-02T00:50:29 | 2021-04-02T16:27:04 | 2021-04-02T13:51:37 | CONTRIBUTOR | null | Mr. Leifer,
First, thanks for creating and maintaining such a great library. We've used it at Propel for many years now.
This PR adds `get_or_none()` to `ModelSelect` in an effort to make the querying API a little more consistent. `Foo.get_or_none()` is very convenient, and we'd like the same sort of convenience ... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2382/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2382/timeline | null | null | false | {
"url": "https://api.github.com/repos/coleifer/peewee/pulls/2382",
"html_url": "https://github.com/coleifer/peewee/pull/2382",
"diff_url": "https://github.com/coleifer/peewee/pull/2382.diff",
"patch_url": "https://github.com/coleifer/peewee/pull/2382.patch",
"merged_at": "2021-04-02T13:51:37"
} |
https://api.github.com/repos/coleifer/peewee/issues/2381 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2381/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2381/comments | https://api.github.com/repos/coleifer/peewee/issues/2381/events | https://github.com/coleifer/peewee/issues/2381 | 848,287,296 | MDU6SXNzdWU4NDgyODcyOTY= | 2,381 | execute count | {
"login": "leshphonc",
"id": 24892968,
"node_id": "MDQ6VXNlcjI0ODkyOTY4",
"avatar_url": "https://avatars.githubusercontent.com/u/24892968?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/leshphonc",
"html_url": "https://github.com/leshphonc",
"followers_url": "https://api.github.com/users/... | [] | closed | false | null | [] | null | [
"是我用法的问题吗,请帮帮我",
"我本地运行是没问题的,放到服务器上就获取不到count了",
"Do not call `.execute()` before count().\r\n\r\nExecute gives you a cursor iterator, not a composable query object.",
"```python\r\n\r\n# This gives us a query object.\r\nquery = User.select().where(User.status == 0)\r\n\r\n# Executes a SELECT COUNT(*)\r\ncoun... | 2021-04-01T09:16:30 | 2021-04-01T13:49:12 | 2021-04-01T12:02:18 | NONE | null | 
| {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2381/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2381/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2380 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2380/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2380/comments | https://api.github.com/repos/coleifer/peewee/issues/2380/events | https://github.com/coleifer/peewee/pull/2380 | 841,930,909 | MDExOlB1bGxSZXF1ZXN0NjAxNTkzMDkz | 2,380 | use https links | {
"login": "imba-tjd",
"id": 24759802,
"node_id": "MDQ6VXNlcjI0NzU5ODAy",
"avatar_url": "https://avatars.githubusercontent.com/u/24759802?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/imba-tjd",
"html_url": "https://github.com/imba-tjd",
"followers_url": "https://api.github.com/users/imb... | [] | closed | false | null | [] | null | [] | 2021-03-26T12:51:11 | 2021-03-26T13:05:34 | 2021-03-26T13:05:34 | NONE | null | `find and replace` these `http://` domains:
* docs.peewee-orm.com
* charlesleifer.com
* media.charlesleifer.com
* sqlite.org | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2380/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2380/timeline | null | null | false | {
"url": "https://api.github.com/repos/coleifer/peewee/pulls/2380",
"html_url": "https://github.com/coleifer/peewee/pull/2380",
"diff_url": "https://github.com/coleifer/peewee/pull/2380.diff",
"patch_url": "https://github.com/coleifer/peewee/pull/2380.patch",
"merged_at": null
} |
https://api.github.com/repos/coleifer/peewee/issues/2379 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2379/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2379/comments | https://api.github.com/repos/coleifer/peewee/issues/2379/events | https://github.com/coleifer/peewee/issues/2379 | 839,170,661 | MDU6SXNzdWU4MzkxNzA2NjE= | 2,379 | Cannot nest database as context manager in transactions | {
"login": "arjd",
"id": 20357504,
"node_id": "MDQ6VXNlcjIwMzU3NTA0",
"avatar_url": "https://avatars.githubusercontent.com/u/20357504?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/arjd",
"html_url": "https://github.com/arjd",
"followers_url": "https://api.github.com/users/arjd/followers"... | [] | closed | false | null | [] | null | [
"What is the intent of such a construction? Using the database as context manager implies you wish to close the database when it exits. Peewee is correctly telling you it cannot close the database because you have explicitly requested a transaction.\r\n\r\nNot a bug, in my opinion."
] | 2021-03-23T22:22:00 | 2021-03-24T13:20:09 | 2021-03-24T13:20:09 | NONE | null | It seems to me that this should be possible:
```
with db.atomic():
with db:
inst = Model.create()
```
But this fails with `OperationalError: Attempting to close database while transaction is open.`.
This is pretty similar to https://github.com/coleifer/peewee/issues/1918 | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2379/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2379/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2378 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2378/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2378/comments | https://api.github.com/repos/coleifer/peewee/issues/2378/events | https://github.com/coleifer/peewee/issues/2378 | 838,195,798 | MDU6SXNzdWU4MzgxOTU3OTg= | 2,378 | Constraints not updated | {
"login": "0scarius",
"id": 7230152,
"node_id": "MDQ6VXNlcjcyMzAxNTI=",
"avatar_url": "https://avatars.githubusercontent.com/u/7230152?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/0scarius",
"html_url": "https://github.com/0scarius",
"followers_url": "https://api.github.com/users/0scar... | [] | closed | false | null | [] | null | [
"Erroneous... wrong place"
] | 2021-03-22T23:52:17 | 2021-03-23T00:14:25 | 2021-03-23T00:10:42 | NONE | null | - | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2378/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2378/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2377 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2377/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2377/comments | https://api.github.com/repos/coleifer/peewee/issues/2377/events | https://github.com/coleifer/peewee/issues/2377 | 836,825,233 | MDU6SXNzdWU4MzY4MjUyMzM= | 2,377 | Not .select()'ed foreign key field raises DoesNotExist with lazy_load=False | {
"login": "AndBondStyle",
"id": 18560701,
"node_id": "MDQ6VXNlcjE4NTYwNzAx",
"avatar_url": "https://avatars.githubusercontent.com/u/18560701?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/AndBondStyle",
"html_url": "https://github.com/AndBondStyle",
"followers_url": "https://api.github.c... | [] | closed | false | null | [] | null | [
"Looks like a regression related to #2328",
"Actually scratch that - this is not a regression. There doesn't seem to be a reliable way of differentiating between a model instance you have explicitly chosen *not* to select the foreign-key value and a model instance that is missing a non-null foreign-key. Lazy-load... | 2021-03-20T14:41:41 | 2021-03-20T18:29:33 | 2021-03-20T18:29:31 | NONE | null | I have a model with a foreign key field like this:
```python3
related_id = ForeignKeyField(OtherModel, lazy_load=False)
```
If you don't include this field in a select query and then try to access it, you get `DoesNotExist` error:
```python3
x = Model.select(Model.id).get() # related_id field not included
print... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2377/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2377/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2376 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2376/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2376/comments | https://api.github.com/repos/coleifer/peewee/issues/2376/events | https://github.com/coleifer/peewee/issues/2376 | 835,005,607 | MDU6SXNzdWU4MzUwMDU2MDc= | 2,376 | Model converter behavior change | {
"login": "vaniakov",
"id": 8692788,
"node_id": "MDQ6VXNlcjg2OTI3ODg=",
"avatar_url": "https://avatars.githubusercontent.com/u/8692788?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/vaniakov",
"html_url": "https://github.com/vaniakov",
"followers_url": "https://api.github.com/users/vania... | [] | closed | false | null | [] | null | [
"Thanks for the succinct report and isolating the problematic changeset. No, this was a regression that I didn't foresee. I've patched this and will issue a new release.",
"This is fixed and I've tagged a new version 3.14.4, which contains the fix and additional tests.",
"@coleifer Thank you for such quick resp... | 2021-03-18T16:16:25 | 2021-03-19T15:58:25 | 2021-03-19T15:55:30 | NONE | null | Hi!
While updating peewee from 3.13.3 to 3.14.3 I noticed model converter behavior change.
If model has __str__ method defined, it is used to represent this model's value in the expression instead of primary key:
```python
import uuid
from peewee import *
db = SqliteDatabase(":memory:")
class BaseModel... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2376/reactions",
"total_count": 1,
"+1": 1,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2376/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2375 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2375/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2375/comments | https://api.github.com/repos/coleifer/peewee/issues/2375/events | https://github.com/coleifer/peewee/issues/2375 | 834,173,752 | MDU6SXNzdWU4MzQxNzM3NTI= | 2,375 | [Q] Is it possible to mark a model object as "unsave-able"? | {
"login": "NightMachinery",
"id": 36224762,
"node_id": "MDQ6VXNlcjM2MjI0NzYy",
"avatar_url": "https://avatars.githubusercontent.com/u/36224762?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/NightMachinery",
"html_url": "https://github.com/NightMachinery",
"followers_url": "https://api.gi... | [] | closed | false | null | [] | null | [
"No, this is not something that is supported in Peewee.",
"@coleifer I just thought about simply setting `model.save = None`. I think this will be enough to prevent me from shooting myself in the foot later ...",
"You would also want to lock-down the update, delete, delete_instance, etc, etc, presumably. If you... | 2021-03-17T20:59:30 | 2021-03-18T00:14:21 | 2021-03-17T21:26:39 | NONE | null | I have some data analysis code that reads some objects from DB, and mutates them for easier analysis; I want to make sure that these mutated objects are never accidentally saved to the database. Is there a way to enforce this? | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2375/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2375/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2374 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2374/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2374/comments | https://api.github.com/repos/coleifer/peewee/issues/2374/events | https://github.com/coleifer/peewee/issues/2374 | 833,790,147 | MDU6SXNzdWU4MzM3OTAxNDc= | 2,374 | [Documentation] Lost link "Advanced Connection Management" | {
"login": "aferrari94",
"id": 70535738,
"node_id": "MDQ6VXNlcjcwNTM1NzM4",
"avatar_url": "https://avatars.githubusercontent.com/u/70535738?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/aferrari94",
"html_url": "https://github.com/aferrari94",
"followers_url": "https://api.github.com/use... | [] | closed | false | null | [] | null | [] | 2021-03-17T13:43:18 | 2021-03-17T13:59:54 | 2021-03-17T13:59:54 | NONE | null | Hi,
I was reading the documentation about the `connection pool` and I think I have found a missing reference caused by a reorganization of documentation with the new versions.
-------------------------
With the doc of the current version (v3.6.0), there is an error about an old link that is pointing to something... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2374/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2374/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2373 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2373/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2373/comments | https://api.github.com/repos/coleifer/peewee/issues/2373/events | https://github.com/coleifer/peewee/issues/2373 | 831,967,456 | MDU6SXNzdWU4MzE5Njc0NTY= | 2,373 | Question about data joining to the same model | {
"login": "hrekov",
"id": 41489462,
"node_id": "MDQ6VXNlcjQxNDg5NDYy",
"avatar_url": "https://avatars.githubusercontent.com/u/41489462?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/hrekov",
"html_url": "https://github.com/hrekov",
"followers_url": "https://api.github.com/users/hrekov/fo... | [] | closed | false | null | [] | null | [
"The problem is a bad manifestation of a bug that occurs when you have a field named \"model\". I probably need to make Peewee raise an error if this occurs, but this fixes things:\r\n\r\n```python\r\n\r\nclass Car(Model):\r\n model_ = CharField(column_name='model', max_length=50, unique=True)\r\n ...\r\n```"... | 2021-03-15T16:12:25 | 2021-03-15T17:00:57 | 2021-03-15T16:50:52 | NONE | null | I have the following code:
```
from datetime import datetime, date
from peewee import *
db = SqliteDatabase(':memory:')
class Car(Model):
model = CharField(max_length=50, unique=True)
manufactured = DateField()
class Meta:
database = db
def __str__(self):
return f'... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2373/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2373/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2372 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2372/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2372/comments | https://api.github.com/repos/coleifer/peewee/issues/2372/events | https://github.com/coleifer/peewee/issues/2372 | 828,103,390 | MDU6SXNzdWU4MjgxMDMzOTA= | 2,372 | Thread safe DB swapping at runtime | {
"login": "induane",
"id": 2320029,
"node_id": "MDQ6VXNlcjIzMjAwMjk=",
"avatar_url": "https://avatars.githubusercontent.com/u/2320029?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/induane",
"html_url": "https://github.com/induane",
"followers_url": "https://api.github.com/users/induane/... | [] | closed | false | null | [] | null | [
"There are two ways you might look at doing this:\r\n\r\n1. re-bind the `SqliteDatabase` instance to a different database file\r\n2. re-bind the models to a different `SqliteDatabase` instance\r\n\r\nI'm not aware of any patterns for doing this an arbitrary number of times at run-time, so you'll have to piece it to... | 2021-03-10T17:42:11 | 2021-03-10T18:58:11 | 2021-03-10T18:03:57 | NONE | null | The use case I have is in using sqlite as an application file format. I need to be able to switch databases at runtime, preferably in a thread safe manner.
I wouldn't mind using a context manager but I've had some issues with the proxyobject. Namely that once I initialize it, it's done globally.
What I'd like to ... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2372/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2372/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2371 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2371/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2371/comments | https://api.github.com/repos/coleifer/peewee/issues/2371/events | https://github.com/coleifer/peewee/issues/2371 | 827,275,167 | MDU6SXNzdWU4MjcyNzUxNjc= | 2,371 | [bug]or where query got a bug not expect sql where | {
"login": "mouday",
"id": 24365682,
"node_id": "MDQ6VXNlcjI0MzY1Njgy",
"avatar_url": "https://avatars.githubusercontent.com/u/24365682?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/mouday",
"html_url": "https://github.com/mouday",
"followers_url": "https://api.github.com/users/mouday/fo... | [] | closed | false | null | [] | null | [
"it's my logic not clean! not a bug. \r\n\r\nthis code is ok.\r\n\r\n```python\r\nrow = (LibProductDataModel\r\n .select()\r\n .where((LibProductDataModel.product == product_or_company)\r\n | (LibProductDataModel.company == product_or_company))\r\n .fir... | 2021-03-10T07:31:35 | 2021-03-10T09:08:32 | 2021-03-10T09:08:32 | NONE | null |
query:
```python
LibProductDataModel
.select()
.where(LibProductDataModel.product == product_or_company
| LibProductDataModel.company == product_or_company)
.first())
```
got:
```sql
('SELECT `t1`.`id`, `t1`.`product`, `t1`.`company`, `t1`.`ticket`, `t1`.`update_time`
FROM `lib_produc... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2371/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2371/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2370 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2370/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2370/comments | https://api.github.com/repos/coleifer/peewee/issues/2370/events | https://github.com/coleifer/peewee/issues/2370 | 826,976,216 | MDU6SXNzdWU4MjY5NzYyMTY= | 2,370 | can i get how long one sql execute time | {
"login": "mouday",
"id": 24365682,
"node_id": "MDQ6VXNlcjI0MzY1Njgy",
"avatar_url": "https://avatars.githubusercontent.com/u/24365682?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/mouday",
"html_url": "https://github.com/mouday",
"followers_url": "https://api.github.com/users/mouday/fo... | [] | closed | false | null | [] | null | [
"Peewee can log all queries. This is documented:\r\n\r\nhttp://docs.peewee-orm.com/en/latest/peewee/database.html#logging-queries\r\n\r\nIf you want to know the sql only for a particular query you can use the `.sql()` method of the query object.\r\n\r\nhttp://docs.peewee-orm.com/en/latest/peewee/api.html#BaseQuery.... | 2021-03-10T02:35:56 | 2021-03-10T03:33:48 | 2021-03-10T02:43:26 | NONE | null | I want to known sql execute time, but logging not show.
just like :
```
10.12 ms SELECT * FROM `person` WHERE `name` = 'Tom' LIMIT 1
``` | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2370/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2370/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2369 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2369/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2369/comments | https://api.github.com/repos/coleifer/peewee/issues/2369/events | https://github.com/coleifer/peewee/pull/2369 | 823,023,647 | MDExOlB1bGxSZXF1ZXN0NTg1NTQ5OTQz | 2,369 | Fix _generate_insert for nullable Fields | {
"login": "rafal-jaworski",
"id": 28957750,
"node_id": "MDQ6VXNlcjI4OTU3NzUw",
"avatar_url": "https://avatars.githubusercontent.com/u/28957750?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/rafal-jaworski",
"html_url": "https://github.com/rafal-jaworski",
"followers_url": "https://api.gi... | [] | closed | false | null | [] | null | [
"I've merged an equivalent patch. Thanks!"
] | 2021-03-05T12:05:56 | 2021-03-05T14:36:49 | 2021-03-05T14:36:49 | NONE | null | I don't know if test is in good file and if the solution is suitable :)
Fixes #2368
| {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2369/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2369/timeline | null | null | false | {
"url": "https://api.github.com/repos/coleifer/peewee/pulls/2369",
"html_url": "https://github.com/coleifer/peewee/pull/2369",
"diff_url": "https://github.com/coleifer/peewee/pull/2369.diff",
"patch_url": "https://github.com/coleifer/peewee/pull/2369.patch",
"merged_at": null
} |
https://api.github.com/repos/coleifer/peewee/issues/2368 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2368/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2368/comments | https://api.github.com/repos/coleifer/peewee/issues/2368/events | https://github.com/coleifer/peewee/issues/2368 | 823,010,737 | MDU6SXNzdWU4MjMwMTA3Mzc= | 2,368 | insert_many() does not generate NULL values for fields with null=True | {
"login": "rafal-jaworski",
"id": 28957750,
"node_id": "MDQ6VXNlcjI4OTU3NzUw",
"avatar_url": "https://avatars.githubusercontent.com/u/28957750?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/rafal-jaworski",
"html_url": "https://github.com/rafal-jaworski",
"followers_url": "https://api.gi... | [] | closed | false | null | [] | null | [
"Thanks, this is fixed now.",
"@coleifer Thanks! Could you release a new version with this fix? :)",
"3.14.3",
"Hey Im still having this issue, and i dont know how to solve it. ",
"Works fine for me:\r\n\r\n```python\r\nclass Reg(Model):\r\n key = TextField()\r\n value = IntegerField(null=True)\r\n ... | 2021-03-05T11:46:39 | 2021-10-28T21:23:55 | 2021-03-05T14:36:35 | NONE | null | Snippet with error.
```python
import peewee
db = peewee.SqliteDatabase('people.db')
class Model(peewee.Model):
name = peewee.CharField()
x = peewee.IntegerField(null=True)
class Meta:
database = db
db.connect()
db.create_tables([Model])
query = Model.insert_many([{"name": "foo... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2368/reactions",
"total_count": 1,
"+1": 1,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2368/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2367 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2367/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2367/comments | https://api.github.com/repos/coleifer/peewee/issues/2367/events | https://github.com/coleifer/peewee/issues/2367 | 822,995,288 | MDU6SXNzdWU4MjI5OTUyODg= | 2,367 | Does peewee create MySQL conn object every time a query execute? | {
"login": "zhuyanxi",
"id": 4001245,
"node_id": "MDQ6VXNlcjQwMDEyNDU=",
"avatar_url": "https://avatars.githubusercontent.com/u/4001245?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/zhuyanxi",
"html_url": "https://github.com/zhuyanxi",
"followers_url": "https://api.github.com/users/zhuya... | [] | closed | false | null | [] | null | [
"If you had spent your time investigating rather than posting this issue, you would find:\r\n\r\nhttp://docs.peewee-orm.com/en/latest/peewee/database.html#connection-management\r\n\r\nIf you want to reuse a connection, then you should use the connection pool, which is mentioned in the above document and also extens... | 2021-03-05T11:23:17 | 2021-03-05T14:18:01 | 2021-03-05T14:17:48 | NONE | null | https://github.com/coleifer/peewee/blob/ac5126d774d89b07b3e8ccb871897e9a0bf53fde/peewee.py#L3972
I find that in the `MySQLDatabase` class , it will create MySQL conn object every time the function `_connect` executed:
```python
def _connect(self):
if mysql is None:
raise ImproperlyConfigured('M... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2367/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2367/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2366 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2366/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2366/comments | https://api.github.com/repos/coleifer/peewee/issues/2366/events | https://github.com/coleifer/peewee/issues/2366 | 822,461,288 | MDU6SXNzdWU4MjI0NjEyODg= | 2,366 | Selecting multiple instances of the same model per row | {
"login": "the-vindicar",
"id": 2130028,
"node_id": "MDQ6VXNlcjIxMzAwMjg=",
"avatar_url": "https://avatars.githubusercontent.com/u/2130028?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/the-vindicar",
"html_url": "https://github.com/the-vindicar",
"followers_url": "https://api.github.com... | [] | closed | false | null | [] | null | [
"In SQL this is natural to return as a tuple, but what you're expressing is represented in Peewee (by default) as a model graph.\r\n\r\nThis hopefully makes it more clear:\r\n\r\n```python\r\n\r\nLiked = Person.alias('liked')\r\n\r\n# Here we are selecting the source person, joining through the Like\r\n# model, and... | 2021-03-04T20:00:32 | 2021-03-05T01:43:33 | 2021-03-05T01:39:56 | NONE | null | Here is a minimal example of what I'm trying to do.
### Model
We have a model in many-to-many relation to itself.
```python
class BaseModel(peewee.Model):
class Meta:
database = peewee.SqliteDatabase(':memory:')
class Person(BaseModel):
id = peewee.AutoField()
name = peewee.TextField()
... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2366/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2366/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2365 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2365/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2365/comments | https://api.github.com/repos/coleifer/peewee/issues/2365/events | https://github.com/coleifer/peewee/issues/2365 | 822,028,438 | MDU6SXNzdWU4MjIwMjg0Mzg= | 2,365 | Connection pool: How to close single connection from pool | {
"login": "kalyanidz",
"id": 56637310,
"node_id": "MDQ6VXNlcjU2NjM3MzEw",
"avatar_url": "https://avatars.githubusercontent.com/u/56637310?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/kalyanidz",
"html_url": "https://github.com/kalyanidz",
"followers_url": "https://api.github.com/users/... | [] | closed | false | null | [] | null | [
"Peewee uses a connection-per-thread, so you get:\r\n\r\n* connect() -> get conn from pool, or if none free create new one\r\n* use connection for a while\r\n* close() -> return connection back to pool\r\n\r\nCalling `db.close()` will close the connection you've been using in the current thread. You use the exact s... | 2021-03-04T11:12:13 | 2021-03-07T09:25:05 | 2021-03-04T13:52:46 | NONE | null | Hello @coleifer
First of all, thank you for developing this simple yet wonderful ORM app peewee. It made the database related coding so well.
We are using postgres connection pool with peewee.
```
db = PooledPostgresqlExtDatabase(
database=db_secret['name'],
user=db_secret['uname'],
... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2365/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2365/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2364 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2364/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2364/comments | https://api.github.com/repos/coleifer/peewee/issues/2364/events | https://github.com/coleifer/peewee/issues/2364 | 821,602,161 | MDU6SXNzdWU4MjE2MDIxNjE= | 2,364 | ARRAY_AGG not returning expected or consistent results | {
"login": "RickMeasham",
"id": 79414,
"node_id": "MDQ6VXNlcjc5NDE0",
"avatar_url": "https://avatars.githubusercontent.com/u/79414?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/RickMeasham",
"html_url": "https://github.com/RickMeasham",
"followers_url": "https://api.github.com/users/Rick... | [] | closed | false | null | [] | null | [
"Peewee uses a heuristic on Function objects called with a single field as the argument, where the idea is to use that field's \"python value\" converter to convert the db value into an appropriate python type. As you've found, this is not always what you want.\r\n\r\nTo resolve this for now, you can explicitly tel... | 2021-03-03T23:43:05 | 2021-03-04T01:59:18 | 2021-03-04T01:59:18 | NONE | null |
[peeweetest.txt](https://github.com/coleifer/peewee/files/6079849/peeweetest.txt)
Aggregating rows in postgresql using Peewee gives unexpected results, depending on the field type.
_The attached file was used to generate these cases._
## The results
### UUID Fields
`fn.ARRAY_AGG(AggregateTest.uuid_field)` ... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2364/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2364/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2363 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2363/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2363/comments | https://api.github.com/repos/coleifer/peewee/issues/2363/events | https://github.com/coleifer/peewee/issues/2363 | 821,076,473 | MDU6SXNzdWU4MjEwNzY0NzM= | 2,363 | CSqliteExtDatabase not available | {
"login": "Nixellion",
"id": 20309785,
"node_id": "MDQ6VXNlcjIwMzA5Nzg1",
"avatar_url": "https://avatars.githubusercontent.com/u/20309785?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/Nixellion",
"html_url": "https://github.com/Nixellion",
"followers_url": "https://api.github.com/users/... | [] | closed | false | null | [] | null | [
"Are you sure cython is installed?\r\nDid you install the python headers? Should be apt install python-dev.\r\nLastly you want sqlite headers. apt install libsqlite3-dev.",
"I ran those commands, python3-dev was already installed. Just in case installed python-dev as well.\r\n\r\nran `apt install libsqlite3-dev` ... | 2021-03-03T12:44:07 | 2021-03-03T19:09:57 | 2021-03-03T13:02:04 | NONE | null | Hi! I've been banging my head against this for a few days now, but I can't figure out how to install peewee with pip and make Cython modules work.
When I run `pip install Cython` and `pip install peewee` it just goes:
```
Collecting peewee
Installing collected packages: peewee
Successfully installed peewee-3.1... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2363/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2363/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2362 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2362/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2362/comments | https://api.github.com/repos/coleifer/peewee/issues/2362/events | https://github.com/coleifer/peewee/issues/2362 | 820,927,681 | MDU6SXNzdWU4MjA5Mjc2ODE= | 2,362 | how to get execute_sql() result to dict? | {
"login": "mouday",
"id": 24365682,
"node_id": "MDQ6VXNlcjI0MzY1Njgy",
"avatar_url": "https://avatars.githubusercontent.com/u/24365682?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/mouday",
"html_url": "https://github.com/mouday",
"followers_url": "https://api.github.com/users/mouday/fo... | [] | closed | false | null | [] | null | [
"The `execute_sql` method is a low level method that talks directly to the db-api cursor. If you want dicts then use the query-builder APIs or the various model query APIs. They are documented\r\n\r\n* http://docs.peewee-orm.com/en/latest/peewee/querying.html#retrieving-row-tuples-dictionaries-namedtuples\r\n* http... | 2021-03-03T09:33:16 | 2021-03-10T03:04:10 | 2021-03-03T13:07:53 | NONE | null | by method execute_sql(), got result is tuple, i want to get dict result like:
```python
{'id': 1}
# or
[{'id': 1}, {'id': 2}]
```
| {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2362/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2362/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2361 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2361/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2361/comments | https://api.github.com/repos/coleifer/peewee/issues/2361/events | https://github.com/coleifer/peewee/issues/2361 | 818,395,908 | MDU6SXNzdWU4MTgzOTU5MDg= | 2,361 | Simpler upsert: `updates` on get_or_create | {
"login": "RickMeasham",
"id": 79414,
"node_id": "MDQ6VXNlcjc5NDE0",
"avatar_url": "https://avatars.githubusercontent.com/u/79414?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/RickMeasham",
"html_url": "https://github.com/RickMeasham",
"followers_url": "https://api.github.com/users/Rick... | [] | closed | false | null | [] | null | [
"For this you should probably be explicit about using the database-specific UPSERT. Because this functionality is not necessarily available across all databases, nor does is it implemented in the same way, Peewee doesn't offer a \"shortcut\" which may mask inefficiencies or gotcha's in the underlying implementation... | 2021-03-01T02:19:24 | 2021-03-01T16:20:10 | 2021-03-01T16:20:10 | NONE | null | _I acknowledge that this functionality may already exist in a similarly simple form and I just haven't found it_
At the moment if I call `get_or_create` the `defaults` clause is only used when we create the object:
```
model, created = Model.get_or_create(
**primary_details,
defaults=**secondary_details
... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2361/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2361/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2360 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2360/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2360/comments | https://api.github.com/repos/coleifer/peewee/issues/2360/events | https://github.com/coleifer/peewee/issues/2360 | 818,223,324 | MDU6SXNzdWU4MTgyMjMzMjQ= | 2,360 | [Q] Do I have to add indexes to peewee if I have manually added them to the table? | {
"login": "NightMachinery",
"id": 36224762,
"node_id": "MDQ6VXNlcjM2MjI0NzYy",
"avatar_url": "https://avatars.githubusercontent.com/u/36224762?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/NightMachinery",
"html_url": "https://github.com/NightMachinery",
"followers_url": "https://api.gi... | [] | closed | false | null | [] | null | [
"The only reason you would need to add them to the Peewee model is if you want Peewee to create them whenever you run `database.create_tables([...])` or `MyModel.create_table()`."
] | 2021-02-28T14:44:46 | 2021-02-28T15:14:07 | 2021-02-28T15:14:07 | NONE | null | I have manually added some indexes using Datagrip to my peewee database. Do I have to add these indexes to the peewee model (i.e., add some peewee Python code), or do things just work? | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2360/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2360/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2359 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2359/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2359/comments | https://api.github.com/repos/coleifer/peewee/issues/2359/events | https://github.com/coleifer/peewee/issues/2359 | 817,760,424 | MDU6SXNzdWU4MTc3NjA0MjQ= | 2,359 | Encoding issue on some weird fields | {
"login": "joveice",
"id": 14098624,
"node_id": "MDQ6VXNlcjE0MDk4NjI0",
"avatar_url": "https://avatars.githubusercontent.com/u/14098624?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/joveice",
"html_url": "https://github.com/joveice",
"followers_url": "https://api.github.com/users/joveic... | [] | closed | false | null | [] | null | [
"```\r\ndb = SqliteDatabase(config.get('save_path'))\r\nconn = db.connection()\r\nconn.text_factory = bytes\r\n```\r\nThis works, would this be a valid way?\r\nSorry for the dumb questions, but this is really new to me.",
"Sqlite uses UTF8 (or UTF16) for text. It sounds like you have a weird encoding. I don't kno... | 2021-02-27T00:02:38 | 2021-02-27T17:57:06 | 2021-02-27T17:57:06 | NONE | null | Hey, I have some issues trying to read some weird fields. I get this encoding exception:
```
Traceback (most recent call last):
File "D:/Projects/autocat-companion/app.py", line 275, in <module>
main()
File "D:/Projects/autocat-companion/app.py", line 173, in main
for x in s:
File "D:\Projects\auto... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2359/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2359/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2358 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2358/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2358/comments | https://api.github.com/repos/coleifer/peewee/issues/2358/events | https://github.com/coleifer/peewee/issues/2358 | 817,277,636 | MDU6SXNzdWU4MTcyNzc2MzY= | 2,358 | Schema keyword and SQLite | {
"login": "LVerneyPEReN",
"id": 58298410,
"node_id": "MDQ6VXNlcjU4Mjk4NDEw",
"avatar_url": "https://avatars.githubusercontent.com/u/58298410?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/LVerneyPEReN",
"html_url": "https://github.com/LVerneyPEReN",
"followers_url": "https://api.github.c... | [] | closed | false | null | [] | null | [
"A lot of people like to use SQLite as a peer for PostgreSQL for local development.\r\nHowever, I think this approach is not always guaranteed to work, and as much as I love SQLite, PostgreSQL has tons of other features to offer.\r\nSo, my question is: if your production code is running with the latter, why are you... | 2021-02-26T11:28:00 | 2021-02-26T13:11:34 | 2021-02-26T12:21:06 | NONE | null | Hi,
I am using the `schema` keyword in my models to store the resulting tables in different PostgreSQL schemas. Typical example is:
```python
database_proxy = peewee.DatabaseProxy()
class Stock(peewee.Model):
class Meta:
database = database_proxy
schema = 'financial-data'
symbo... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2358/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2358/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2357 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2357/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2357/comments | https://api.github.com/repos/coleifer/peewee/issues/2357/events | https://github.com/coleifer/peewee/issues/2357 | 816,556,197 | MDU6SXNzdWU4MTY1NTYxOTc= | 2,357 | Incorrect data saving | {
"login": "sorokousov",
"id": 36851598,
"node_id": "MDQ6VXNlcjM2ODUxNTk4",
"avatar_url": "https://avatars.githubusercontent.com/u/36851598?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/sorokousov",
"html_url": "https://github.com/sorokousov",
"followers_url": "https://api.github.com/use... | [] | closed | false | null | [] | null | [
"You have a trailing comma:\r\n\r\n```python\r\n\r\npth.deck_original = bliat,\r\npth.deck_current = bliat,\r\n```",
"Oh, my God, this is my mistake)))\r\nThanks you!!!",
"somehow i had the exact same mistake. Thank god this issue exist :)\r\n"
] | 2021-02-25T15:44:14 | 2023-04-24T12:29:12 | 2021-02-25T16:16:24 | NONE | null | I apologize in advance for my English.
I will describe the problem in a few steps:
1. Creating a model for storing a deck of cards:
```
db = pw.MySQLDatabase(database=db, user=user, password=password, host=host, port=port)`
class PTH(pw.Model):`
deck_original = pw.TextField(null=True)
deck_current... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2357/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2357/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2356 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2356/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2356/comments | https://api.github.com/repos/coleifer/peewee/issues/2356/events | https://github.com/coleifer/peewee/issues/2356 | 816,276,322 | MDU6SXNzdWU4MTYyNzYzMjI= | 2,356 | Missing datatype numrange for postgresql | {
"login": "DanielAndreasen",
"id": 4519017,
"node_id": "MDQ6VXNlcjQ1MTkwMTc=",
"avatar_url": "https://avatars.githubusercontent.com/u/4519017?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/DanielAndreasen",
"html_url": "https://github.com/DanielAndreasen",
"followers_url": "https://api.g... | [] | closed | false | null | [] | null | [
"I have played around a bit with the source code to get this to work, and found a simple solution that seems to work. I add the following `class` to `playhouse.postgres_ext`\r\n\r\n```python\r\nfrom psycopg2._range import NumericRange\r\n\r\n...\r\n\r\nclass NumericRange(Field, NumericRange):\r\n field_type = 'N... | 2021-02-25T09:56:03 | 2021-02-25T14:37:42 | 2021-02-25T14:09:42 | NONE | null | I have a case, where I need the datatype [`numrange`](https://www.postgresql.org/docs/9.2/rangetypes.html), however I cannot find it in `playhouse.postgres_ext`.
Is it possible to implement this? I know it already exists in `psycopg2._range.NumericRange`.
Just for clarification, I have tried making a table like thi... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2356/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2356/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2355 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2355/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2355/comments | https://api.github.com/repos/coleifer/peewee/issues/2355/events | https://github.com/coleifer/peewee/issues/2355 | 814,997,780 | MDU6SXNzdWU4MTQ5OTc3ODA= | 2,355 | Enable handling of DB lock collisions | {
"login": "lselker13",
"id": 12423842,
"node_id": "MDQ6VXNlcjEyNDIzODQy",
"avatar_url": "https://avatars.githubusercontent.com/u/12423842?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/lselker13",
"html_url": "https://github.com/lselker13",
"followers_url": "https://api.github.com/users/... | [] | closed | false | null | [] | null | [
"The error is raised by the sqlite driver you are using -- I'd suggest checking the error message contained in the exception if you want to do special handling of this exception. For general suggestions on how to handle sqlite's write-locking, these posts may help:\r\n\r\n* https://charlesleifer.com/blog/going-fast... | 2021-02-24T01:38:03 | 2021-02-24T03:21:22 | 2021-02-24T03:20:01 | NONE | null | I'm using Peewee with SQLite DBs. Is there a way to either specify behavior in cases of lock collisions, or to programmatically detect whether a lock collision has occurred, as opposed to some other error?
A lock collision seem to result in an `OperationalError`. This is a relatively broad Peewee error (e.g. attempt... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2355/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2355/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2354 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2354/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2354/comments | https://api.github.com/repos/coleifer/peewee/issues/2354/events | https://github.com/coleifer/peewee/issues/2354 | 812,660,415 | MDU6SXNzdWU4MTI2NjA0MTU= | 2,354 | [Feature request] Define foreign key constraint name | {
"login": "ms-lilibeth",
"id": 10104959,
"node_id": "MDQ6VXNlcjEwMTA0OTU5",
"avatar_url": "https://avatars.githubusercontent.com/u/10104959?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/ms-lilibeth",
"html_url": "https://github.com/ms-lilibeth",
"followers_url": "https://api.github.com/... | [] | closed | false | null | [] | null | [
"I've gone ahead and added support for this as the changes required were not extensive, although this is honestly the first time this has come up in 10+ years so I don't know it will be of much general benefit. One gotcha: MySQL doesn't seem to support inlining named check constraints into the field definition, but... | 2021-02-20T16:52:57 | 2021-02-21T02:18:08 | 2021-02-21T02:18:08 | NONE | null | I am working with SQLite, and I am really disappointed with the fact that peewee does not assign any name for a foreign key constraint when it builds an SQL query (`peewee.py`: `ForeignKeyField.foreign_key_constraint()`)
I have three foreign keys in my model, and the full error message from SQLite is just `FOREIGN K... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2354/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2354/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2353 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2353/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2353/comments | https://api.github.com/repos/coleifer/peewee/issues/2353/events | https://github.com/coleifer/peewee/pull/2353 | 812,336,794 | MDExOlB1bGxSZXF1ZXN0NTc2NzE5NjA3 | 2,353 | Attempt new connections if the server is not ready | {
"login": "pierky",
"id": 6806218,
"node_id": "MDQ6VXNlcjY4MDYyMTg=",
"avatar_url": "https://avatars.githubusercontent.com/u/6806218?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/pierky",
"html_url": "https://github.com/pierky",
"followers_url": "https://api.github.com/users/pierky/foll... | [] | closed | false | null | [] | null | [
">Not the perfect solution, I know, I'd just like to see if something along this line would be accepted\r\n\r\nI'd suggest putting this into your own subclass of `MySQLDatabase` (or `ReconnectMixin`, whichever you use) as I don't intend to maintain this code or advocate this approach."
] | 2021-02-19T20:48:58 | 2021-02-19T21:53:06 | 2021-02-19T21:53:05 | NONE | null | When using `ReconnectMixin`, the execution of a SQL statement is attempted again if it fails because of "operational issue" (for example when the connection to the DB server is lost). During the reconnection phase, the DB server might not be ready to handle new connections, thus the call to `self.connect()` could also ... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2353/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2353/timeline | null | null | false | {
"url": "https://api.github.com/repos/coleifer/peewee/pulls/2353",
"html_url": "https://github.com/coleifer/peewee/pull/2353",
"diff_url": "https://github.com/coleifer/peewee/pull/2353.diff",
"patch_url": "https://github.com/coleifer/peewee/pull/2353.patch",
"merged_at": null
} |
https://api.github.com/repos/coleifer/peewee/issues/2352 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2352/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2352/comments | https://api.github.com/repos/coleifer/peewee/issues/2352/events | https://github.com/coleifer/peewee/issues/2352 | 812,261,004 | MDU6SXNzdWU4MTIyNjEwMDQ= | 2,352 | add_column only applies default value if column does not allow null | {
"login": "feixie",
"id": 394007,
"node_id": "MDQ6VXNlcjM5NDAwNw==",
"avatar_url": "https://avatars.githubusercontent.com/u/394007?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/feixie",
"html_url": "https://github.com/feixie",
"followers_url": "https://api.github.com/users/feixie/follow... | [] | closed | false | null | [] | null | [
"The `apply_default()` method is exposed as an operation, just like `add_column()`. Since \"defaults\" specified this way are implemented in Python rather than as a sql default constraint, I've avoided automatically applying them when the field is left nullable (as this implies an UPDATE of every row of the table).... | 2021-02-19T18:58:24 | 2021-02-19T22:01:22 | 2021-02-19T22:01:22 | NONE | null | I would like to add columns that allow nulls AND have a default value. While I can define columns with default values and null=True when I create the table, I can't do it via add_column because this line: https://github.com/coleifer/peewee/blob/master/playhouse/migrate.py#L329 only applies the default value when the fi... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2352/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2352/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2351 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2351/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2351/comments | https://api.github.com/repos/coleifer/peewee/issues/2351/events | https://github.com/coleifer/peewee/issues/2351 | 811,440,185 | MDU6SXNzdWU4MTE0NDAxODU= | 2,351 | Migrator applies the same value from callable default | {
"login": "zgoda",
"id": 141999,
"node_id": "MDQ6VXNlcjE0MTk5OQ==",
"avatar_url": "https://avatars.githubusercontent.com/u/141999?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/zgoda",
"html_url": "https://github.com/zgoda",
"followers_url": "https://api.github.com/users/zgoda/followers"... | [] | closed | false | null | [] | null | [
"If it's a python callable what's peewee supposed to do... iterate every single row and update it? That would not work and would cause performance problems for users because it is unexpected.\r\n\r\nIf you want, you can use a sql function - sqlite lets you add user-defined functions quite easily - and even use them... | 2021-02-18T20:39:55 | 2021-02-18T23:13:36 | 2021-02-18T23:13:36 | CONTRIBUTOR | null | With value generator like
```python
def gen_nanoid():
return nanoid.generate(size=12)
```
and migration definition:
```python
def add_permalink():
field = CharField(max_length=20, default=gen_nanoid)
migrate(
migrator.add_column('quip', 'permalink', field)
)
```
All rows in ... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2351/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2351/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2350 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2350/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2350/comments | https://api.github.com/repos/coleifer/peewee/issues/2350/events | https://github.com/coleifer/peewee/issues/2350 | 811,041,784 | MDU6SXNzdWU4MTEwNDE3ODQ= | 2,350 | Extension support check in setup.py needs path to sqlite3.h and sqlite3.lib files on Windows. | {
"login": "cdcadman",
"id": 51368516,
"node_id": "MDQ6VXNlcjUxMzY4NTE2",
"avatar_url": "https://avatars.githubusercontent.com/u/51368516?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/cdcadman",
"html_url": "https://github.com/cdcadman",
"followers_url": "https://api.github.com/users/cdc... | [] | closed | false | null | [] | null | [
"Glad you got it working."
] | 2021-02-18T12:09:52 | 2021-02-18T15:23:49 | 2021-02-18T15:23:49 | NONE | null | Initially, when I ran `python setup.py build_ext -i`, I got the following message.
<pre>test_pw_sqlite3.c(1): fatal error C1083: Cannot open include file: 'sqlite3.h': No such file or directory
unable to compile sqlite3 C extensions - missing headers?
setup.py:100: UserWarning: Could not find libsqlite3, SQLite ex... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2350/reactions",
"total_count": 1,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 1,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2350/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2349 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2349/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2349/comments | https://api.github.com/repos/coleifer/peewee/issues/2349/events | https://github.com/coleifer/peewee/issues/2349 | 807,959,540 | MDU6SXNzdWU4MDc5NTk1NDA= | 2,349 | DESC not working in jsonb type | {
"login": "daeeros",
"id": 34482855,
"node_id": "MDQ6VXNlcjM0NDgyODU1",
"avatar_url": "https://avatars.githubusercontent.com/u/34482855?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/daeeros",
"html_url": "https://github.com/daeeros",
"followers_url": "https://api.github.com/users/daeero... | [] | closed | false | null | [] | null | [
"It works fine for me:\r\n\r\n```python\r\n\r\nclass T(Model):\r\n data = BinaryJSONField()\r\n class Meta:\r\n database = db\r\n\r\ndb.drop_tables([T])\r\ndb.create_tables([T])\r\nT.create(data={'k1': 'v1', 'k2': 'v2'})\r\nT.create(data={'k1': 'v3', 'k2': 'v4'})\r\nT.create(data={'k1': 'v5', 'k2': 'v6... | 2021-02-14T13:18:54 | 2021-02-14T15:13:34 | 2021-02-14T15:13:34 | NONE | null | .desc() not working in jsob table,
```
class Player(BaseModel):
user_id = IntegerField()
ivent_stats = BinaryJSONField(default={"safe": 0,
"bomb": 0,
"robbery": 0})
players = await db.execute(Player.select(Player.user_i... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2349/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2349/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2348 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2348/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2348/comments | https://api.github.com/repos/coleifer/peewee/issues/2348/events | https://github.com/coleifer/peewee/issues/2348 | 807,937,225 | MDU6SXNzdWU4MDc5MzcyMjU= | 2,348 | Issue on postgres_ext.ArrayField python_value conversion | {
"login": "whisust",
"id": 22323709,
"node_id": "MDQ6VXNlcjIyMzIzNzA5",
"avatar_url": "https://avatars.githubusercontent.com/u/22323709?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/whisust",
"html_url": "https://github.com/whisust",
"followers_url": "https://api.github.com/users/whisus... | [] | closed | false | null | [] | null | [
"I've tried switching the `UUIDField` in a `CharField` for the `course_ids` in the example, and the result of the converter is the following:\r\n\r\n\r\nTypes are ok because, in... | 2021-02-14T11:01:32 | 2021-02-14T15:38:03 | 2021-02-14T15:38:02 | NONE | null | The `ArrayField.python_value` functions seems to misuse the conversion function in the case of a `convert_value=True` field:
Given:
```python
import uuid
from uuid import UUID
from peewee import *
from typing import List
class Program(Model):
"""
SQL:
CREATE TABLE IF NOT EXISTS programs
... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2348/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2348/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2347 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2347/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2347/comments | https://api.github.com/repos/coleifer/peewee/issues/2347/events | https://github.com/coleifer/peewee/issues/2347 | 806,167,748 | MDU6SXNzdWU4MDYxNjc3NDg= | 2,347 | Undocumented conflict with field name "_path"? | {
"login": "alvenhar",
"id": 61888606,
"node_id": "MDQ6VXNlcjYxODg4NjA2",
"avatar_url": "https://avatars.githubusercontent.com/u/61888606?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/alvenhar",
"html_url": "https://github.com/alvenhar",
"followers_url": "https://api.github.com/users/alv... | [] | closed | false | null | [] | null | [
"Thanks for the report. Not going to take any action on this at the moment, but feel free to open a patch to add a section to the docs."
] | 2021-02-11T08:09:33 | 2021-02-11T15:46:08 | 2021-02-11T15:46:08 | NONE | null | Hi, I recently encountered the problem that peewee's create_tables() call hung indefinitely and started eating up massive RAM for a minuscule database setup. I finally figured out that the "offensive" change was that I named a CharField on one of my models "_path". As soon as I changed that to "_path_str", everything w... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2347/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2347/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2346 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2346/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2346/comments | https://api.github.com/repos/coleifer/peewee/issues/2346/events | https://github.com/coleifer/peewee/issues/2346 | 806,011,694 | MDU6SXNzdWU4MDYwMTE2OTQ= | 2,346 | Support for a new db type | {
"login": "pfw",
"id": 92163,
"node_id": "MDQ6VXNlcjkyMTYz",
"avatar_url": "https://avatars.githubusercontent.com/u/92163?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/pfw",
"html_url": "https://github.com/pfw",
"followers_url": "https://api.github.com/users/pfw/followers",
"following... | [] | closed | false | null | [] | null | [
"Pretty much. You'll want to use a db-api 2.0 compatible driver, e.g. one of:\r\n\r\nhttps://www.firebirdsql.org/file/documentation/drivers_documentation/python/3.3.0/Python-DB-API-2.0.html\r\n\r\nYou would subclass `Database` and start by implementing the `_connect()` method and go from there. I'm not familiar wit... | 2021-02-11T01:31:15 | 2021-02-11T03:06:43 | 2021-02-11T02:54:46 | NONE | null | I'm interested in peewee since it is lightweight and looks approachable while still supporting what we require. We have some data in FirebirdSQL and I was going to have a look at getting peewee going against it as an experiment and learning experience.
To get it up and running would it 'just' require implementing a... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2346/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2346/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2345 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2345/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2345/comments | https://api.github.com/repos/coleifer/peewee/issues/2345/events | https://github.com/coleifer/peewee/issues/2345 | 805,352,954 | MDU6SXNzdWU4MDUzNTI5NTQ= | 2,345 | Race condition at class level when dynamically binding the DB | {
"login": "whisust",
"id": 22323709,
"node_id": "MDQ6VXNlcjIyMzIzNzA5",
"avatar_url": "https://avatars.githubusercontent.com/u/22323709?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/whisust",
"html_url": "https://github.com/whisust",
"followers_url": "https://api.github.com/users/whisus... | [] | closed | false | null | [] | null | [
">We select the database dynamically depending on the query to run.\r\n>A read-only query will be run using connections from the read-able pools;\r\n>A write query will be run only on the leader pool.\r\n>Thus, before each query, we model.bind(db) using the correct db\r\n\r\nYou might try storing `Model._meta.datab... | 2021-02-10T09:51:18 | 2021-02-10T15:54:24 | 2021-02-10T15:48:06 | NONE | null | Related to https://github.com/coleifer/peewee/issues/2339 and in a minor way https://github.com/coleifer/peewee/issues/2306
# Context
Usage of peewee with
- two connection pools to the same database, one being restricted in read-only (read replica or read-only user)
- usage in a greenlet environment (here gunicor... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2345/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2345/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2344 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2344/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2344/comments | https://api.github.com/repos/coleifer/peewee/issues/2344/events | https://github.com/coleifer/peewee/issues/2344 | 803,558,603 | MDU6SXNzdWU4MDM1NTg2MDM= | 2,344 | Syntax error near "VALUES" when using ValuesList and Tuple | {
"login": "cvanea",
"id": 17099087,
"node_id": "MDQ6VXNlcjE3MDk5MDg3",
"avatar_url": "https://avatars.githubusercontent.com/u/17099087?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/cvanea",
"html_url": "https://github.com/cvanea",
"followers_url": "https://api.github.com/users/cvanea/fo... | [] | closed | false | null | [] | null | [
"As a workaround you can add parentheses by:\r\n\r\n```python\r\n\r\nfrom peewee import EnclosedNodeList\r\n\r\nvl = ValuesList(coords, columns=('x', 'y'))\r\nrhs = EnclosedNodeList([vl])\r\n...where(Tuple(T.x, T.y).in_(rhs))\r\n```",
"If you're using Sqlite, it is very picky about what it accepts. The following ... | 2021-02-08T13:19:14 | 2021-02-10T10:20:43 | 2021-02-09T20:37:50 | NONE | null | Hi,
I'm trying to select rows from a table where the given row values are in a list of tuples. As I understand it, SQLite can only support this kind of IN operation if the right-hand side is a subquery expression. Therefore, in SQLite the following works:
```sql
CREATE TABLE T1(x,y,z);
INSERT INTO T1(x,y,z) VA... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2344/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2344/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2343 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2343/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2343/comments | https://api.github.com/repos/coleifer/peewee/issues/2343/events | https://github.com/coleifer/peewee/issues/2343 | 802,782,702 | MDU6SXNzdWU4MDI3ODI3MDI= | 2,343 | Can not add a not null column to a table with CHECK constraint | {
"login": "feixie",
"id": 394007,
"node_id": "MDQ6VXNlcjM5NDAwNw==",
"avatar_url": "https://avatars.githubusercontent.com/u/394007?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/feixie",
"html_url": "https://github.com/feixie",
"followers_url": "https://api.github.com/users/feixie/follow... | [] | closed | false | null | [] | null | [
"Thanks for the report. This is fixed in master."
] | 2021-02-06T20:17:40 | 2021-02-07T14:37:45 | 2021-02-07T14:37:40 | NONE | null | Most of the tables in my sqlite db have CHECK constraints. The schema of one such table looks like this:
`CREATE TABLE "study" ("id" INTEGER NOT NULL PRIMARY KEY, "created_at" DATETIME NOT NULL, "uid" TEXT NOT NULL, "patient_id" VARCHAR(255) NOT NULL, "provider_id" VARCHAR(255) NOT NULL, "first_name" VARCHAR(255) NO... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2343/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2343/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2342 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2342/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2342/comments | https://api.github.com/repos/coleifer/peewee/issues/2342/events | https://github.com/coleifer/peewee/issues/2342 | 802,779,858 | MDU6SXNzdWU4MDI3Nzk4NTg= | 2,342 | Feature request: A Database for testing that just navigates through Model attributes | {
"login": "dmyersturnbull",
"id": 3979879,
"node_id": "MDQ6VXNlcjM5Nzk4Nzk=",
"avatar_url": "https://avatars.githubusercontent.com/u/3979879?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/dmyersturnbull",
"html_url": "https://github.com/dmyersturnbull",
"followers_url": "https://api.gith... | [] | closed | false | null | [] | null | [
"A \"fake\"/in-memory system is not going to happen. One would need to implement relational algebra and all the intricacies of a sql storage engine.\r\n\r\nThere are suggestions in the docs for testing: http://docs.peewee-orm.com/en/latest/peewee/database.html#testing-peewee-applications\r\n\r\nThose are the recomm... | 2021-02-06T20:03:56 | 2021-02-07T13:59:39 | 2021-02-07T13:59:38 | NONE | null | I've had a great experience with Peewee so far. Thanks for your work maintaining it!
I apologize if this is better suited for StackOverflow -- it seems like more of a feature request, but perhaps it's out of scope or there's an extant solution.
My main issue with using Peewee is that it's difficult to abstract aw... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2342/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2342/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2341 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2341/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2341/comments | https://api.github.com/repos/coleifer/peewee/issues/2341/events | https://github.com/coleifer/peewee/issues/2341 | 802,292,084 | MDU6SXNzdWU4MDIyOTIwODQ= | 2,341 | [Question] Update if existing value is zero | {
"login": "karambaq",
"id": 14233969,
"node_id": "MDQ6VXNlcjE0MjMzOTY5",
"avatar_url": "https://avatars.githubusercontent.com/u/14233969?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/karambaq",
"html_url": "https://github.com/karambaq",
"followers_url": "https://api.github.com/users/kar... | [] | closed | false | null | [] | null | [
"First: post questions to stack overflow.\r\n\r\nSecond - this is covered in all the very basic docs. Please consult them:\r\n\r\n```python\r\nwhere((Model.id=id) & (Model.field_name == 0))\r\n```\r\n\r\nhttp://docs.peewee-orm.com/en/latest/peewee/contributing.html#questions"
] | 2021-02-05T16:15:26 | 2021-02-05T16:17:14 | 2021-02-05T16:17:14 | NONE | null | Hey there!
I need to update the existing record field if the value of the existing field is equal to zero, how can I do it?
I've tried:
```
query = Model.update(field_name=new_value).where(Model.id=id and Model.field_name == 0)
query.execute()
```
But it seems like it doesn't work, am I doing something wro... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2341/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2341/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2340 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2340/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2340/comments | https://api.github.com/repos/coleifer/peewee/issues/2340/events | https://github.com/coleifer/peewee/issues/2340 | 801,998,123 | MDU6SXNzdWU4MDE5OTgxMjM= | 2,340 | Introspector changes Integer field which is primary key to Serial type (AutoField) in dynamically-generated model from Postgres Database | {
"login": "AlexeyYuNovikov",
"id": 45177856,
"node_id": "MDQ6VXNlcjQ1MTc3ODU2",
"avatar_url": "https://avatars.githubusercontent.com/u/45177856?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/AlexeyYuNovikov",
"html_url": "https://github.com/AlexeyYuNovikov",
"followers_url": "https://api... | [] | closed | false | null | [] | null | [
"The reflection stuff is not perfect and uses a heuristic in some cases. If the primary-key is a single integer column, then the reflection assumes it is auto-increment. Similarly, we don't pull the character-length for varchar column types - although this may change in a future version. These are both known limita... | 2021-02-05T09:22:39 | 2021-02-05T13:50:17 | 2021-02-05T13:50:17 | NONE | null | When I'm trying to get dynamically-generated model from existing table in Postgres database, I've found that fields with type Integer become fields with type AutoField in generated model if those fields are primary key.
This fields in my DB have unique values which is really key values. I'm getting them from another ... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2340/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2340/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2339 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2339/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2339/comments | https://api.github.com/repos/coleifer/peewee/issues/2339/events | https://github.com/coleifer/peewee/issues/2339 | 801,545,143 | MDU6SXNzdWU4MDE1NDUxNDM= | 2,339 | Usage in a replicated Postgres cluster | {
"login": "whisust",
"id": 22323709,
"node_id": "MDQ6VXNlcjIyMzIzNzA5",
"avatar_url": "https://avatars.githubusercontent.com/u/22323709?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/whisust",
"html_url": "https://github.com/whisust",
"followers_url": "https://api.github.com/users/whisus... | [] | closed | false | null | [] | null | [
"Not really, no, it's kind-of up to you how you want to handle that. It's not something that is \"officially\" supported, although there are ways you can do it, as you allude to. I'm not sure what would be making it sporadically fail under-load, either - that seems odd if it works correctly under general circumstan... | 2021-02-04T18:47:12 | 2021-02-04T20:54:47 | 2021-02-04T20:54:47 | NONE | null | Hi, I'm using Peewee in prod and recently we set up a read replica.
As far as I've seen in the issues and the doc, there is no support to specify a `database` that could be used for read-only queries.
I'm using this piece of code for dynamic database binding at run-time since a few months, but under some load (ge... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2339/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2339/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2338 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2338/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2338/comments | https://api.github.com/repos/coleifer/peewee/issues/2338/events | https://github.com/coleifer/peewee/issues/2338 | 801,389,785 | MDU6SXNzdWU4MDEzODk3ODU= | 2,338 | Left join doen't work | {
"login": "JPilarr",
"id": 45560120,
"node_id": "MDQ6VXNlcjQ1NTYwMTIw",
"avatar_url": "https://avatars.githubusercontent.com/u/45560120?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/JPilarr",
"html_url": "https://github.com/JPilarr",
"followers_url": "https://api.github.com/users/JPilar... | [] | closed | false | null | [] | null | [
"How are you accessing `printfile`? You may need to explicitly specify the target attribute you want your joined `PrintFile` instance to be bound to:\r\n\r\n```python\r\n\r\nquery = (Job.select(Job, Printer, PrintFile)\r\n .where(*conds)\r\n .join(Printer)\r\n .join(PrintFile,\r\n ... | 2021-02-04T15:29:02 | 2021-02-05T08:57:43 | 2021-02-04T15:42:32 | NONE | null |
```
query = (Job.select(Job, Printer, PrintFile)
.where(*conds)
.join(Printer)
.join(PrintFile,
pw.JOIN.LEFT_OUTER,
on=PrintFile.hash == Job.hash)
.order_by(-Job.start, Job.printer, -Job.id)
.limit(limit)
.o... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2338/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2338/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2337 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2337/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2337/comments | https://api.github.com/repos/coleifer/peewee/issues/2337/events | https://github.com/coleifer/peewee/issues/2337 | 800,170,715 | MDU6SXNzdWU4MDAxNzA3MTU= | 2,337 | Different processing of datetime in different databases | {
"login": "ztj1993",
"id": 13493380,
"node_id": "MDQ6VXNlcjEzNDkzMzgw",
"avatar_url": "https://avatars.githubusercontent.com/u/13493380?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/ztj1993",
"html_url": "https://github.com/ztj1993",
"followers_url": "https://api.github.com/users/ztj199... | [] | closed | false | null | [] | null | [
"Peewee datetime field exposes properties like `.year` which use a db-specific extract (or equivalent) function. So you can write:\r\n\r\n```python\r\n\r\nquery = (DataModel\r\n .select(DataModel.d_t.year, fn.SUM(DataModel.val))\r\n .where(...)\r\n .group_by(DataModel.d_t.year))\r\n```\r\n\r... | 2021-02-03T10:02:36 | 2021-02-03T11:13:13 | 2021-02-03T11:13:13 | NONE | null | I'm writing something related to statistics. I don't want to limit the database. Different databases handle different dates and times.
I tested extract_ However, different databases need to be dealt with separately, resulting in the following problems:
1.How to get the database type of the model;
2.If I want to ... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2337/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2337/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2336 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2336/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2336/comments | https://api.github.com/repos/coleifer/peewee/issues/2336/events | https://github.com/coleifer/peewee/issues/2336 | 799,031,291 | MDU6SXNzdWU3OTkwMzEyOTE= | 2,336 | ImproperlyConfigured: MySQL connector not installed! | {
"login": "thisnugroho",
"id": 49790011,
"node_id": "MDQ6VXNlcjQ5NzkwMDEx",
"avatar_url": "https://avatars.githubusercontent.com/u/49790011?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/thisnugroho",
"html_url": "https://github.com/thisnugroho",
"followers_url": "https://api.github.com/... | [] | closed | false | null | [] | null | [
"It looks like you're using a virtual environment. You may need to be sure mysql-connector is installed in your venv. Whatever is happening, the problem is that peewee cannot import mysql.connector.\r\n\r\nYou can verify this yourself in your script. Place this at the top:\r\n\r\n```python\r\nimport mysql.connector... | 2021-02-02T07:54:52 | 2021-02-03T06:27:23 | 2021-02-02T14:01:12 | NONE | null | hello, first I wanna thank you guys who made this, it's very helpfull for me who just start learning python, migrating from PHP 😁,
I got an error like in this picture below,

it's said I don't have mys... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2336/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2336/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2335 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2335/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2335/comments | https://api.github.com/repos/coleifer/peewee/issues/2335/events | https://github.com/coleifer/peewee/issues/2335 | 797,310,452 | MDU6SXNzdWU3OTczMTA0NTI= | 2,335 | distinct() on a ModelCompoundSelectQuery raises an error | {
"login": "arel",
"id": 153497,
"node_id": "MDQ6VXNlcjE1MzQ5Nw==",
"avatar_url": "https://avatars.githubusercontent.com/u/153497?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/arel",
"html_url": "https://github.com/arel",
"followers_url": "https://api.github.com/users/arel/followers",
... | [] | closed | false | null | [] | null | [
"This is because the convention is different when using UNION and UNION ALL. From which side of the union would you be selecting \"distinct\" from, in your example? You could put distinct on both the left- and right-half of the query, but I think what you want is actually just the regular behavior of UNION.\r\n\r\n... | 2021-01-30T02:07:53 | 2021-01-30T22:01:22 | 2021-01-30T22:01:22 | NONE | null | I am using peewee version 3.14.0. A see that `ModelCompoundSelectQuery` does not have a `distinct()` method, and calling it raises the error:
```
AttributeError: 'ModelCompoundSelectQuery' object has no attribute 'distinct'
```
For example:
```python
o1 = User.select().where(User.id < 5)
o2 = User.select()... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2335/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2335/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2334 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2334/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2334/comments | https://api.github.com/repos/coleifer/peewee/issues/2334/events | https://github.com/coleifer/peewee/issues/2334 | 796,668,028 | MDU6SXNzdWU3OTY2NjgwMjg= | 2,334 | How to set postgres cursor.itersize from peewee? | {
"login": "qacollective",
"id": 25289661,
"node_id": "MDQ6VXNlcjI1Mjg5NjYx",
"avatar_url": "https://avatars.githubusercontent.com/u/25289661?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/qacollective",
"html_url": "https://github.com/qacollective",
"followers_url": "https://api.github.c... | [] | closed | false | null | [] | null | [
"You can try overriding the `cursor()` method used by Peewee to create the db-api 2 cursor:\r\n\r\n```python\r\n\r\nclass PGDatabase(PostgresqlExtDatabase):\r\n def cursor(self, commit=None):\r\n cursor = super(PGDatabase, self).cursor(commit=commit)\r\n cursor.itersize = 50000\r\n return cu... | 2021-01-29T07:59:57 | 2021-02-18T01:29:25 | 2021-01-29T15:36:18 | NONE | null | I am using Peewee with PostgreSQL and server side cursors as per [the documentation](http://docs.peewee-orm.com/en/latest/peewee/playhouse.html#server-side-cursors) and realise that the default row fetch size is 2000. I've verified this by looking at the queries being sent to the server.
It works really well, my co... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2334/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2334/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2333 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2333/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2333/comments | https://api.github.com/repos/coleifer/peewee/issues/2333/events | https://github.com/coleifer/peewee/issues/2333 | 796,405,043 | MDU6SXNzdWU3OTY0MDUwNDM= | 2,333 | `generate_models` returns empty `dict` | {
"login": "vsheg",
"id": 36817377,
"node_id": "MDQ6VXNlcjM2ODE3Mzc3",
"avatar_url": "https://avatars.githubusercontent.com/u/36817377?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/vsheg",
"html_url": "https://github.com/vsheg",
"followers_url": "https://api.github.com/users/vsheg/follow... | [] | closed | false | null | [] | null | [
"I have no idea what might be going on in your setup. This code is covered with unit tests so it is not fundamentally broken:\r\n\r\nhttps://github.com/coleifer/peewee/blob/master/tests/reflection.py#L81\r\n\r\nI'd suggest debugging or providing more information. Possibly some mismatch between what sqlalchemy db co... | 2021-01-28T21:49:11 | 2021-01-28T22:41:10 | 2021-01-28T22:40:01 | NONE | null | Hi,
I want to see tables in my predefined database (it was created with `SQLAlchemy` and modified with GUI Beekeeper Studio)
1. When I use `peewee` I get noting:
```python
from peewee import PostgresqlDatabase
from playhouse.reflection import generate_models
db = PostgresqlDatabase('postgres', user=getenv('... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2333/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2333/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2332 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2332/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2332/comments | https://api.github.com/repos/coleifer/peewee/issues/2332/events | https://github.com/coleifer/peewee/issues/2332 | 795,943,044 | MDU6SXNzdWU3OTU5NDMwNDQ= | 2,332 | Upsert with Model.save() | {
"login": "tuukkamustonen",
"id": 94327,
"node_id": "MDQ6VXNlcjk0MzI3",
"avatar_url": "https://avatars.githubusercontent.com/u/94327?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/tuukkamustonen",
"html_url": "https://github.com/tuukkamustonen",
"followers_url": "https://api.github.com/u... | [] | closed | false | null | [] | null | [
"First, it's not `bulk_insert()` - it's `bulk_create()`. This method takes a list of unsaved models and inserts them into the db, then maps the returned IDs back to the model instances for Postgres. When you add \"on conflict\" into the mix, then you can get the unpredictable scenario of some model pks being return... | 2021-01-28T12:01:49 | 2021-01-29T06:44:12 | 2021-01-28T14:25:55 | NONE | null | In https://github.com/coleifer/peewee/issues/2275 you explain why `.bulk_insert()` cannot support upsert:
> The problem arises w/postgres where the insert cursor returns IDs only for the rows that are created, which can't be mapped back to the actual objects that were inserted.
I'm not sure how to interpret that.... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2332/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2332/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2331 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2331/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2331/comments | https://api.github.com/repos/coleifer/peewee/issues/2331/events | https://github.com/coleifer/peewee/issues/2331 | 792,985,031 | MDU6SXNzdWU3OTI5ODUwMzE= | 2,331 | How to repeat use query? | {
"login": "mouday",
"id": 24365682,
"node_id": "MDQ6VXNlcjI0MzY1Njgy",
"avatar_url": "https://avatars.githubusercontent.com/u/24365682?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/mouday",
"html_url": "https://github.com/mouday",
"followers_url": "https://api.github.com/users/mouday/fo... | [] | closed | false | null | [] | null | [
"This is a great thing to ask on stackoverflow. The issue tracker is for issues w/peewee, while questions should go on stackoverflow or the #peewee irc on freenode.\r\n\r\n```python\r\n# Did you try this?\r\nquery =UserModel.select()\r\n\r\nif name:\r\n query = query.where(UserModel.name == name)\r\nif age:\r\n ... | 2021-01-25T03:05:36 | 2021-01-26T02:16:00 | 2021-01-25T14:20:41 | NONE | null | I want to use peewee query like:
```python
# query list
query =UserModel.select()
if name:
query = query.where(UserModel.name == name)
if age:
query = query.where(UserModel.age == age)
lst = query.dicts()
```
```python
# query count
query =UserModel.select()
if name:
query = query.w... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2331/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2331/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2330 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2330/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2330/comments | https://api.github.com/repos/coleifer/peewee/issues/2330/events | https://github.com/coleifer/peewee/issues/2330 | 792,417,535 | MDU6SXNzdWU3OTI0MTc1MzU= | 2,330 | How to specify some fields when using the function of replace()? | {
"login": "vba34520",
"id": 40198281,
"node_id": "MDQ6VXNlcjQwMTk4Mjgx",
"avatar_url": "https://avatars.githubusercontent.com/u/40198281?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/vba34520",
"html_url": "https://github.com/vba34520",
"followers_url": "https://api.github.com/users/vba... | [] | closed | false | null | [] | null | [
"Replace will delete the row and replace it with the data you provide.\r\n\r\nI think what you want is \"update()\"."
] | 2021-01-23T02:50:19 | 2021-01-23T13:07:05 | 2021-01-23T13:07:05 | NONE | null | How to specify some fields when using the function of [`replace()`](http://docs.peewee-orm.com/en/latest/peewee/api.html#Model.replace)?
1. http://docs.peewee-orm.com/en/latest/peewee/api.html#Model.replace
2. http://docs.peewee-orm.com/en/latest/peewee/querying.html#upsert
I give a primary key to [`replace()`]... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2330/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2330/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2329 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2329/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2329/comments | https://api.github.com/repos/coleifer/peewee/issues/2329/events | https://github.com/coleifer/peewee/pull/2329 | 792,161,448 | MDExOlB1bGxSZXF1ZXN0NTYwMDkxMjg2 | 2,329 | Allow deferred foreign keys on lazy loading. | {
"login": "conqp",
"id": 3766192,
"node_id": "MDQ6VXNlcjM3NjYxOTI=",
"avatar_url": "https://avatars.githubusercontent.com/u/3766192?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/conqp",
"html_url": "https://github.com/conqp",
"followers_url": "https://api.github.com/users/conqp/follower... | [] | closed | false | null | [] | null | [
"Thanks for this - I've merged an equivalent patch which includes a regression test as well: b34e60154fbb7e2a0aabd271dd55017f1b0af8f0"
] | 2021-01-22T16:58:19 | 2021-01-22T20:22:07 | 2021-01-22T20:22:07 | CONTRIBUTOR | null | Fixes #2328. | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2329/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2329/timeline | null | null | false | {
"url": "https://api.github.com/repos/coleifer/peewee/pulls/2329",
"html_url": "https://github.com/coleifer/peewee/pull/2329",
"diff_url": "https://github.com/coleifer/peewee/pull/2329.diff",
"patch_url": "https://github.com/coleifer/peewee/pull/2329.patch",
"merged_at": null
} |
https://api.github.com/repos/coleifer/peewee/issues/2328 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2328/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2328/comments | https://api.github.com/repos/coleifer/peewee/issues/2328/events | https://github.com/coleifer/peewee/issues/2328 | 792,161,039 | MDU6SXNzdWU3OTIxNjEwMzk= | 2,328 | Allow deferring of foreign keys when lazy_load is disabled | {
"login": "conqp",
"id": 3766192,
"node_id": "MDQ6VXNlcjM3NjYxOTI=",
"avatar_url": "https://avatars.githubusercontent.com/u/3766192?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/conqp",
"html_url": "https://github.com/conqp",
"followers_url": "https://api.github.com/users/conqp/follower... | [] | closed | false | null | [] | null | [
"Thanks for this - I've merged an equivalent patch which includes a regression test as well: b34e601"
] | 2021-01-22T16:57:42 | 2021-01-22T20:22:16 | 2021-01-22T20:22:16 | CONTRIBUTOR | null | I just encountered a problem when disabling lazy loading on foreign keys.
```python
class Referenced(Model): pass
class Referencing(Model):
ref = ForeignKeyField(Referenced, lazy_load=False)
referenced = Referenced()
referencing = Referencing()
referenging.ref = referenced
referenced.save()
referenc... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2328/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2328/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2327 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2327/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2327/comments | https://api.github.com/repos/coleifer/peewee/issues/2327/events | https://github.com/coleifer/peewee/issues/2327 | 791,027,482 | MDU6SXNzdWU3OTEwMjc0ODI= | 2,327 | Add model information to DoesNotExist | {
"login": "conqp",
"id": 3766192,
"node_id": "MDQ6VXNlcjM3NjYxOTI=",
"avatar_url": "https://avatars.githubusercontent.com/u/3766192?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/conqp",
"html_url": "https://github.com/conqp",
"followers_url": "https://api.github.com/users/conqp/follower... | [] | closed | false | null | [] | null | [
"This seems of somewhat questionable utility as it seems more likely you would want to catch- and handle those exceptions rather than bubbling them all the way up to the web framework to handle generically. I'm going to pass on this for now, but will keep an eye out for other requesters/use-cases for this and re-ev... | 2021-01-21T12:29:30 | 2021-01-21T17:15:45 | 2021-01-21T14:19:41 | CONTRIBUTOR | null | Currently it is hard to extract model context from generic `DoesNotExist` exceptions.
It would be nice, if the `DoesNotExist` class would have information about the model, so I can do something like this:
```python
from flask import Flask
from peewee import DoesNotExist, Model, ModelBase
APPLICATION = Flask('m... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2327/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2327/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2326 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2326/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2326/comments | https://api.github.com/repos/coleifer/peewee/issues/2326/events | https://github.com/coleifer/peewee/issues/2326 | 785,380,616 | MDU6SXNzdWU3ODUzODA2MTY= | 2,326 | callback on record insert, delete and update | {
"login": "sugizo",
"id": 2418295,
"node_id": "MDQ6VXNlcjI0MTgyOTU=",
"avatar_url": "https://avatars.githubusercontent.com/u/2418295?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/sugizo",
"html_url": "https://github.com/sugizo",
"followers_url": "https://api.github.com/users/sugizo/foll... | [] | closed | false | null | [] | null | [
"No, this is not really supported by Peewee. Rather, you should probably be implementing your callbacks in your application rather than as part of core peewee (along with your validation, or whatever else you need to do). You can, of course, override the `save()` method and do things in there if you wish:\r\n\r\n``... | 2021-01-13T19:25:45 | 2021-01-14T01:33:02 | 2021-01-14T01:33:02 | NONE | null | # Objective
before insert table can execute python function to convert data
**e.g.**
user insert Field intervals in list [2, 2, 1, 2, 2, 2, 1]
then base on list above automatically convert and insert into Field intervals_name with [W, W, H, W, W, W, H] on the same table
**or**
after insert table can send ... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2326/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2326/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2325 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2325/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2325/comments | https://api.github.com/repos/coleifer/peewee/issues/2325/events | https://github.com/coleifer/peewee/issues/2325 | 785,160,168 | MDU6SXNzdWU3ODUxNjAxNjg= | 2,325 | Sponsor project? | {
"login": "milesgranger",
"id": 13764397,
"node_id": "MDQ6VXNlcjEzNzY0Mzk3",
"avatar_url": "https://avatars.githubusercontent.com/u/13764397?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/milesgranger",
"html_url": "https://github.com/milesgranger",
"followers_url": "https://api.github.c... | [] | closed | false | null | [] | null | [
"Thanks, @milesgranger. I don't seek sponsorships (I'm gratefully employed at this time), but I'm happy to encourage you to donate to a charitable cause.",
"Should have clarified this was on behalf of an organization which uses peewee extensively and wanted to \"give back\" a bit. However, I'll take your suggesti... | 2021-01-13T14:38:51 | 2021-01-13T17:42:41 | 2021-01-13T16:50:30 | NONE | null | Hi,
Just want to say how much I appreciate this project and how tightly maintained it is! :clap:
Would you be willing to enable sponsorship for this project and/or for yourself as a developer? | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2325/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2325/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2324 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2324/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2324/comments | https://api.github.com/repos/coleifer/peewee/issues/2324/events | https://github.com/coleifer/peewee/issues/2324 | 781,376,245 | MDU6SXNzdWU3ODEzNzYyNDU= | 2,324 | Many-to-many relations and their entries | {
"login": "thmsklngr",
"id": 6360498,
"node_id": "MDQ6VXNlcjYzNjA0OTg=",
"avatar_url": "https://avatars.githubusercontent.com/u/6360498?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/thmsklngr",
"html_url": "https://github.com/thmsklngr",
"followers_url": "https://api.github.com/users/th... | [] | closed | false | null | [] | null | [
"You would want to use a unique constraint on the two foreign-keys in your intermediate table.\r\n\r\nThen use the `insert into ... on conflict ignore` (or the equivalent) when inserting, to tell the database \"if this insert would violate the unique constraint, then discard it\". Sqlite, MySQL and Postgres all sup... | 2021-01-07T15:00:47 | 2021-01-07T15:22:05 | 2021-01-07T15:22:05 | NONE | null | Hi,
currently I'm switching an application from PonyORM to Peewee, which is somehow a challenge (both ORMs ;) ). One thing which is difficult to me, is the handling of many-to-many relations. I'd like to avoid the ManyToManyField, so I try to implement it with the suggested default solution.
Selecting from the in... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2324/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2324/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2323 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2323/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2323/comments | https://api.github.com/repos/coleifer/peewee/issues/2323/events | https://github.com/coleifer/peewee/issues/2323 | 780,623,895 | MDU6SXNzdWU3ODA2MjM4OTU= | 2,323 | Query results to json? | {
"login": "jet10000",
"id": 2258120,
"node_id": "MDQ6VXNlcjIyNTgxMjA=",
"avatar_url": "https://avatars.githubusercontent.com/u/2258120?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/jet10000",
"html_url": "https://github.com/jet10000",
"followers_url": "https://api.github.com/users/jet10... | [] | closed | false | null | [] | null | [
"* http://docs.peewee-orm.com/en/latest/peewee/querying.html#retrieving-row-tuples-dictionaries-namedtuples - specifically `.dicts()`\r\n* http://docs.peewee-orm.com/en/latest/peewee/playhouse.html#shortcuts\r\n* http://docs.peewee-orm.com/en/latest/peewee/playhouse.html#model_to_dict\r\n\r\nPlease post questions t... | 2021-01-06T15:11:25 | 2021-01-06T15:16:20 | 2021-01-06T15:15:56 | NONE | null | Is there a convenient way to directly convert the query result into json, or into an orjson object? | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2323/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2323/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2322 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2322/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2322/comments | https://api.github.com/repos/coleifer/peewee/issues/2322/events | https://github.com/coleifer/peewee/issues/2322 | 780,557,891 | MDU6SXNzdWU3ODA1NTc4OTE= | 2,322 | Using ESCAPE with Sqlite | {
"login": "mtihlenfield",
"id": 15360891,
"node_id": "MDQ6VXNlcjE1MzYwODkx",
"avatar_url": "https://avatars.githubusercontent.com/u/15360891?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/mtihlenfield",
"html_url": "https://github.com/mtihlenfield",
"followers_url": "https://api.github.c... | [] | closed | false | null | [] | null | [
"Solved this just using `SQL()` like so:\r\n```\r\nSymbol.select().where(SQL(\"name LIKE ? ESCAPE '\\\\'\", (sym_name, )))\r\n```",
"Peewee now automatically escapes when you use `.contains()`, `.startswith()` or `.endswith()`. So your example would be:\r\n\r\n```python\r\n\r\nSymbol.select().where(Symbol.name.en... | 2021-01-06T13:37:19 | 2021-01-06T13:51:42 | 2021-01-06T13:50:50 | NONE | null | I'm essentially trying to do the same exact thing as #348, but the solution there recommends using `Clause`, which doesn't seem to exist any longer. There no longer seems to be a way to execute a query like:
`select * from symbol where name LIKE "%\_printf" ESCAPE "\"`
on an sqlite database without just resorting... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2322/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2322/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2321 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2321/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2321/comments | https://api.github.com/repos/coleifer/peewee/issues/2321/events | https://github.com/coleifer/peewee/issues/2321 | 778,067,168 | MDU6SXNzdWU3NzgwNjcxNjg= | 2,321 | Could you tell me how to operating the content of the update only a data? | {
"login": "BarryYBL",
"id": 46100874,
"node_id": "MDQ6VXNlcjQ2MTAwODc0",
"avatar_url": "https://avatars.githubusercontent.com/u/46100874?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/BarryYBL",
"html_url": "https://github.com/BarryYBL",
"followers_url": "https://api.github.com/users/Bar... | [] | closed | false | null | [] | null | [
"You need to put `.execute()` when you are finished creating your update query.\r\n\r\n```python\r\nUser.update(username='foo').where(id=20).execute()\r\n```\r\n\r\nPlease do not post simple questions on the issue tracker. Use stackoverflow for questions.",
"But he has updated my all username key value!\r\nHow d... | 2021-01-04T12:40:27 | 2021-01-04T14:38:42 | 2021-01-04T13:30:00 | NONE | null | user.update(username='tudou').where(id='20')
There is no effect!
He put all the table data keys are updated | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2321/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2321/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2320 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2320/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2320/comments | https://api.github.com/repos/coleifer/peewee/issues/2320/events | https://github.com/coleifer/peewee/issues/2320 | 777,711,733 | MDU6SXNzdWU3Nzc3MTE3MzM= | 2,320 | KeyError when iterating over query from subquery with CTE | {
"login": "Neirop",
"id": 35473102,
"node_id": "MDQ6VXNlcjM1NDczMTAy",
"avatar_url": "https://avatars.githubusercontent.com/u/35473102?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/Neirop",
"html_url": "https://github.com/Neirop",
"followers_url": "https://api.github.com/users/Neirop/fo... | [] | closed | false | null | [] | null | [
"Thanks for the succinct report. This is now resolved."
] | 2021-01-03T20:34:48 | 2021-01-14T16:04:42 | 2021-01-14T16:04:24 | NONE | null | Database: Postgresql 12
Peewee version: 3.14.0
Model:
```
class BaseModel(Model):
class Meta:
database = database
class Channel(BaseModel):
channel_id = IntegerField(primary_key=True)
channel_name = TextField()
class Meta:
table_name = 'channel'
class UserMessage(... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2320/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2320/timeline | null | completed | null | null |
https://api.github.com/repos/coleifer/peewee/issues/2319 | https://api.github.com/repos/coleifer/peewee | https://api.github.com/repos/coleifer/peewee/issues/2319/labels{/name} | https://api.github.com/repos/coleifer/peewee/issues/2319/comments | https://api.github.com/repos/coleifer/peewee/issues/2319/events | https://github.com/coleifer/peewee/issues/2319 | 775,553,513 | MDU6SXNzdWU3NzU1NTM1MTM= | 2,319 | 'SqliteDatabase' object has no attribute 'create_index' error when calling create_index() method in Table class | {
"login": "ldconejo",
"id": 5453372,
"node_id": "MDQ6VXNlcjU0NTMzNzI=",
"avatar_url": "https://avatars.githubusercontent.com/u/5453372?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/ldconejo",
"html_url": "https://github.com/ldconejo",
"followers_url": "https://api.github.com/users/ldcon... | [] | closed | false | null | [] | null | [
"Thank you for the report. I've pushed a fix for this.",
"Thank you so much!"
] | 2020-12-28T19:29:38 | 2020-12-29T19:07:15 | 2020-12-28T20:20:35 | NONE | null | Operating System: MacOS
Python version: 3.9
Peewee version: 3.14.0
It seems the _create_index()_ method in SQLite was deprecated, in turn breaking the _create_index()_ method in the Table class. The method in _dataset.py_ works as a wrapper:
```
def create_index(self, columns, unique=False):
self.... | {
"url": "https://api.github.com/repos/coleifer/peewee/issues/2319/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} | https://api.github.com/repos/coleifer/peewee/issues/2319/timeline | null | completed | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.