piccolo 0.110.0__tar.gz → 0.111.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (355) hide show
  1. {piccolo-0.110.0 → piccolo-0.111.0}/PKG-INFO +1 -1
  2. piccolo-0.111.0/piccolo/__init__.py +1 -0
  3. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/asgi/commands/new.py +1 -1
  4. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/query/methods/insert.py +61 -5
  5. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/query/methods/objects.py +2 -0
  6. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/query/methods/select.py +5 -7
  7. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/query/mixins.py +168 -4
  8. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo.egg-info/PKG-INFO +1 -1
  9. piccolo-0.111.0/tests/table/test_insert.py +474 -0
  10. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/test_select.py +2 -2
  11. piccolo-0.110.0/piccolo/__init__.py +0 -1
  12. piccolo-0.110.0/tests/table/test_insert.py +0 -78
  13. {piccolo-0.110.0 → piccolo-0.111.0}/README.md +0 -0
  14. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/__init__.py +0 -0
  15. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/app/__init__.py +0 -0
  16. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/app/commands/__init__.py +0 -0
  17. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/app/commands/new.py +0 -0
  18. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/app/commands/show_all.py +0 -0
  19. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/app/commands/templates/piccolo_app.py.jinja +0 -0
  20. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/app/commands/templates/tables.py.jinja +0 -0
  21. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/app/piccolo_app.py +0 -0
  22. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/asgi/__init__.py +0 -0
  23. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/asgi/commands/__init__.py +0 -0
  24. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/asgi/commands/templates/app/README.md.jinja +0 -0
  25. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/asgi/commands/templates/app/_blacksheep_app.py.jinja +0 -0
  26. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/asgi/commands/templates/app/_fastapi_app.py.jinja +0 -0
  27. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/asgi/commands/templates/app/_litestar_app.py.jinja +0 -0
  28. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/asgi/commands/templates/app/_starlette_app.py.jinja +0 -0
  29. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/asgi/commands/templates/app/app.py.jinja +0 -0
  30. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/asgi/commands/templates/app/conftest.py.jinja +0 -0
  31. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/asgi/commands/templates/app/home/__init__.py.jinja +0 -0
  32. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/asgi/commands/templates/app/home/_blacksheep_endpoints.py.jinja +0 -0
  33. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/asgi/commands/templates/app/home/_litestar_endpoints.py.jinja +0 -0
  34. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/asgi/commands/templates/app/home/_starlette_endpoints.py.jinja +0 -0
  35. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/asgi/commands/templates/app/home/endpoints.py.jinja +0 -0
  36. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/asgi/commands/templates/app/home/piccolo_app.py.jinja +0 -0
  37. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/asgi/commands/templates/app/home/piccolo_migrations/README.md +0 -0
  38. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/asgi/commands/templates/app/home/tables.py.jinja +0 -0
  39. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/asgi/commands/templates/app/home/templates/base.html.jinja_raw +0 -0
  40. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/asgi/commands/templates/app/home/templates/home.html.jinja_raw +0 -0
  41. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/asgi/commands/templates/app/main.py.jinja +0 -0
  42. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/asgi/commands/templates/app/piccolo_conf.py.jinja +0 -0
  43. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/asgi/commands/templates/app/piccolo_conf_test.py.jinja +0 -0
  44. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/asgi/commands/templates/app/requirements.txt.jinja +0 -0
  45. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/asgi/commands/templates/app/static/favicon.ico +0 -0
  46. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/asgi/commands/templates/app/static/main.css +0 -0
  47. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/asgi/piccolo_app.py +0 -0
  48. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/fixtures/__init__.py +0 -0
  49. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/fixtures/commands/__init__.py +0 -0
  50. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/fixtures/commands/dump.py +0 -0
  51. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/fixtures/commands/load.py +0 -0
  52. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/fixtures/commands/shared.py +0 -0
  53. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/fixtures/piccolo_app.py +0 -0
  54. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/meta/__init__.py +0 -0
  55. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/meta/commands/__init__.py +0 -0
  56. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/meta/commands/version.py +0 -0
  57. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/meta/piccolo_app.py +0 -0
  58. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/migrations/__init__.py +0 -0
  59. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/migrations/auto/__init__.py +0 -0
  60. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/migrations/auto/diffable_table.py +0 -0
  61. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/migrations/auto/migration_manager.py +0 -0
  62. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/migrations/auto/operations.py +0 -0
  63. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/migrations/auto/schema_differ.py +0 -0
  64. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/migrations/auto/schema_snapshot.py +0 -0
  65. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/migrations/auto/serialisation.py +0 -0
  66. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/migrations/auto/serialisation_legacy.py +0 -0
  67. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/migrations/commands/__init__.py +0 -0
  68. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/migrations/commands/backwards.py +0 -0
  69. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/migrations/commands/base.py +0 -0
  70. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/migrations/commands/check.py +0 -0
  71. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/migrations/commands/clean.py +0 -0
  72. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/migrations/commands/forwards.py +0 -0
  73. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/migrations/commands/new.py +0 -0
  74. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/migrations/commands/templates/migration.py.jinja +0 -0
  75. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/migrations/piccolo_app.py +0 -0
  76. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/migrations/tables.py +0 -0
  77. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/playground/__init__.py +0 -0
  78. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/playground/commands/__init__.py +0 -0
  79. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/playground/commands/run.py +0 -0
  80. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/playground/piccolo_app.py +0 -0
  81. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/project/__init__.py +0 -0
  82. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/project/commands/__init__.py +0 -0
  83. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/project/commands/new.py +0 -0
  84. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/project/commands/templates/piccolo_conf.py.jinja +0 -0
  85. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/project/piccolo_app.py +0 -0
  86. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/schema/__init__.py +0 -0
  87. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/schema/commands/__init__.py +0 -0
  88. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/schema/commands/exceptions.py +0 -0
  89. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/schema/commands/generate.py +0 -0
  90. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/schema/commands/graph.py +0 -0
  91. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/schema/commands/templates/graphviz.dot.jinja +0 -0
  92. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/schema/piccolo_app.py +0 -0
  93. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/shell/__init__.py +0 -0
  94. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/shell/commands/__init__.py +0 -0
  95. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/shell/commands/run.py +0 -0
  96. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/shell/piccolo_app.py +0 -0
  97. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/sql_shell/__init__.py +0 -0
  98. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/sql_shell/commands/__init__.py +0 -0
  99. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/sql_shell/commands/run.py +0 -0
  100. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/sql_shell/piccolo_app.py +0 -0
  101. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/tester/__init__.py +0 -0
  102. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/tester/commands/__init__.py +0 -0
  103. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/tester/commands/run.py +0 -0
  104. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/tester/piccolo_app.py +0 -0
  105. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/user/__init__.py +0 -0
  106. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/user/commands/__init__.py +0 -0
  107. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/user/commands/change_password.py +0 -0
  108. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/user/commands/change_permissions.py +0 -0
  109. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/user/commands/create.py +0 -0
  110. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/user/piccolo_app.py +0 -0
  111. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/user/piccolo_migrations/2019-11-14T21-52-21.py +0 -0
  112. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/user/piccolo_migrations/2020-06-11T21-38-55.py +0 -0
  113. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/user/piccolo_migrations/2021-04-30T16-14-15.py +0 -0
  114. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/user/piccolo_migrations/__init__.py +0 -0
  115. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/apps/user/tables.py +0 -0
  116. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/columns/__init__.py +0 -0
  117. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/columns/base.py +0 -0
  118. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/columns/choices.py +0 -0
  119. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/columns/column_types.py +0 -0
  120. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/columns/combination.py +0 -0
  121. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/columns/defaults/__init__.py +0 -0
  122. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/columns/defaults/base.py +0 -0
  123. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/columns/defaults/date.py +0 -0
  124. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/columns/defaults/interval.py +0 -0
  125. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/columns/defaults/time.py +0 -0
  126. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/columns/defaults/timestamp.py +0 -0
  127. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/columns/defaults/timestamptz.py +0 -0
  128. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/columns/defaults/uuid.py +0 -0
  129. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/columns/indexes.py +0 -0
  130. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/columns/m2m.py +0 -0
  131. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/columns/operators/__init__.py +0 -0
  132. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/columns/operators/base.py +0 -0
  133. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/columns/operators/comparison.py +0 -0
  134. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/columns/operators/math.py +0 -0
  135. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/columns/operators/string.py +0 -0
  136. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/columns/readable.py +0 -0
  137. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/columns/reference.py +0 -0
  138. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/conf/__init__.py +0 -0
  139. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/conf/apps.py +0 -0
  140. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/custom_types.py +0 -0
  141. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/engine/__init__.py +0 -0
  142. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/engine/base.py +0 -0
  143. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/engine/cockroach.py +0 -0
  144. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/engine/exceptions.py +0 -0
  145. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/engine/finder.py +0 -0
  146. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/engine/postgres.py +0 -0
  147. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/engine/sqlite.py +0 -0
  148. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/main.py +0 -0
  149. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/py.typed +0 -0
  150. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/query/__init__.py +0 -0
  151. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/query/base.py +0 -0
  152. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/query/methods/__init__.py +0 -0
  153. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/query/methods/alter.py +0 -0
  154. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/query/methods/count.py +0 -0
  155. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/query/methods/create.py +0 -0
  156. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/query/methods/create_index.py +0 -0
  157. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/query/methods/delete.py +0 -0
  158. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/query/methods/drop_index.py +0 -0
  159. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/query/methods/exists.py +0 -0
  160. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/query/methods/indexes.py +0 -0
  161. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/query/methods/raw.py +0 -0
  162. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/query/methods/refresh.py +0 -0
  163. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/query/methods/table_exists.py +0 -0
  164. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/query/methods/update.py +0 -0
  165. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/query/proxy.py +0 -0
  166. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/querystring.py +0 -0
  167. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/table.py +0 -0
  168. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/table_reflection.py +0 -0
  169. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/testing/__init__.py +0 -0
  170. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/testing/model_builder.py +0 -0
  171. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/testing/random_builder.py +0 -0
  172. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/utils/__init__.py +0 -0
  173. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/utils/dictionary.py +0 -0
  174. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/utils/encoding.py +0 -0
  175. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/utils/graphlib/__init__.py +0 -0
  176. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/utils/graphlib/_graphlib.py +0 -0
  177. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/utils/lazy_loader.py +0 -0
  178. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/utils/list.py +0 -0
  179. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/utils/naming.py +0 -0
  180. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/utils/objects.py +0 -0
  181. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/utils/printing.py +0 -0
  182. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/utils/pydantic.py +0 -0
  183. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/utils/repr.py +0 -0
  184. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/utils/sql_values.py +0 -0
  185. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/utils/sync.py +0 -0
  186. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo/utils/warnings.py +0 -0
  187. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo.egg-info/SOURCES.txt +0 -0
  188. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo.egg-info/dependency_links.txt +0 -0
  189. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo.egg-info/entry_points.txt +0 -0
  190. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo.egg-info/requires.txt +0 -0
  191. {piccolo-0.110.0 → piccolo-0.111.0}/piccolo.egg-info/top_level.txt +0 -0
  192. {piccolo-0.110.0 → piccolo-0.111.0}/profiling/__init__.py +0 -0
  193. {piccolo-0.110.0 → piccolo-0.111.0}/profiling/run_profile.py +0 -0
  194. {piccolo-0.110.0 → piccolo-0.111.0}/pyproject.toml +0 -0
  195. {piccolo-0.110.0 → piccolo-0.111.0}/setup.cfg +0 -0
  196. {piccolo-0.110.0 → piccolo-0.111.0}/setup.py +0 -0
  197. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/__init__.py +0 -0
  198. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/app/__init__.py +0 -0
  199. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/app/commands/__init__.py +0 -0
  200. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/app/commands/test_new.py +0 -0
  201. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/app/commands/test_show_all.py +0 -0
  202. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/asgi/__init__.py +0 -0
  203. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/asgi/commands/__init__.py +0 -0
  204. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/asgi/commands/test_new.py +0 -0
  205. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/fixtures/__init__.py +0 -0
  206. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/fixtures/commands/__init__.py +0 -0
  207. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/fixtures/commands/test_dump_load.py +0 -0
  208. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/fixtures/commands/test_shared.py +0 -0
  209. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/meta/__init__.py +0 -0
  210. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/meta/commands/__init__.py +0 -0
  211. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/meta/commands/test_version.py +0 -0
  212. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/migrations/__init__.py +0 -0
  213. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/migrations/auto/__init__.py +0 -0
  214. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/migrations/auto/integration/__init__.py +0 -0
  215. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/migrations/auto/integration/test_migrations.py +0 -0
  216. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/migrations/auto/test_diffable_table.py +0 -0
  217. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/migrations/auto/test_migration_manager.py +0 -0
  218. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/migrations/auto/test_schema_differ.py +0 -0
  219. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/migrations/auto/test_schema_snapshot.py +0 -0
  220. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/migrations/auto/test_serialisation.py +0 -0
  221. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/migrations/commands/__init__.py +0 -0
  222. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/migrations/commands/test_base.py +0 -0
  223. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/migrations/commands/test_check.py +0 -0
  224. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/migrations/commands/test_clean.py +0 -0
  225. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/migrations/commands/test_forwards_backwards.py +0 -0
  226. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/migrations/commands/test_migrations/2020-03-31T20-38-22.py +0 -0
  227. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/migrations/commands/test_migrations/__init__.py +0 -0
  228. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/migrations/commands/test_new.py +0 -0
  229. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/migrations/test_migration.py +0 -0
  230. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/project/__init__.py +0 -0
  231. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/project/commands/__init__.py +0 -0
  232. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/project/commands/test_new.py +0 -0
  233. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/schema/__init__.py +0 -0
  234. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/shell/__init__.py +0 -0
  235. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/shell/commands/__init__.py +0 -0
  236. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/shell/commands/test_run.py +0 -0
  237. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/sql_shell/__init__.py +0 -0
  238. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/sql_shell/commands/__init__.py +0 -0
  239. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/sql_shell/commands/test_run.py +0 -0
  240. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/tester/__init__.py +0 -0
  241. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/user/__init__.py +0 -0
  242. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/user/commands/__init__.py +0 -0
  243. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/user/commands/test_change_password.py +0 -0
  244. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/user/commands/test_change_permissions.py +0 -0
  245. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/user/commands/test_create.py +0 -0
  246. {piccolo-0.110.0 → piccolo-0.111.0}/tests/apps/user/test_tables.py +0 -0
  247. {piccolo-0.110.0 → piccolo-0.111.0}/tests/columns/__init__.py +0 -0
  248. {piccolo-0.110.0 → piccolo-0.111.0}/tests/columns/test_array.py +0 -0
  249. {piccolo-0.110.0 → piccolo-0.111.0}/tests/columns/test_base.py +0 -0
  250. {piccolo-0.110.0 → piccolo-0.111.0}/tests/columns/test_bigint.py +0 -0
  251. {piccolo-0.110.0 → piccolo-0.111.0}/tests/columns/test_boolean.py +0 -0
  252. {piccolo-0.110.0 → piccolo-0.111.0}/tests/columns/test_bytea.py +0 -0
  253. {piccolo-0.110.0 → piccolo-0.111.0}/tests/columns/test_choices.py +0 -0
  254. {piccolo-0.110.0 → piccolo-0.111.0}/tests/columns/test_combination.py +0 -0
  255. {piccolo-0.110.0 → piccolo-0.111.0}/tests/columns/test_date.py +0 -0
  256. {piccolo-0.110.0 → piccolo-0.111.0}/tests/columns/test_db_column_name.py +0 -0
  257. {piccolo-0.110.0 → piccolo-0.111.0}/tests/columns/test_defaults.py +0 -0
  258. {piccolo-0.110.0 → piccolo-0.111.0}/tests/columns/test_double_precision.py +0 -0
  259. {piccolo-0.110.0 → piccolo-0.111.0}/tests/columns/test_interval.py +0 -0
  260. {piccolo-0.110.0 → piccolo-0.111.0}/tests/columns/test_json.py +0 -0
  261. {piccolo-0.110.0 → piccolo-0.111.0}/tests/columns/test_jsonb.py +0 -0
  262. {piccolo-0.110.0 → piccolo-0.111.0}/tests/columns/test_m2m.py +0 -0
  263. {piccolo-0.110.0 → piccolo-0.111.0}/tests/columns/test_numeric.py +0 -0
  264. {piccolo-0.110.0 → piccolo-0.111.0}/tests/columns/test_primary_key.py +0 -0
  265. {piccolo-0.110.0 → piccolo-0.111.0}/tests/columns/test_readable.py +0 -0
  266. {piccolo-0.110.0 → piccolo-0.111.0}/tests/columns/test_real.py +0 -0
  267. {piccolo-0.110.0 → piccolo-0.111.0}/tests/columns/test_reference.py +0 -0
  268. {piccolo-0.110.0 → piccolo-0.111.0}/tests/columns/test_reserved_column_names.py +0 -0
  269. {piccolo-0.110.0 → piccolo-0.111.0}/tests/columns/test_smallint.py +0 -0
  270. {piccolo-0.110.0 → piccolo-0.111.0}/tests/columns/test_time.py +0 -0
  271. {piccolo-0.110.0 → piccolo-0.111.0}/tests/columns/test_timestamp.py +0 -0
  272. {piccolo-0.110.0 → piccolo-0.111.0}/tests/columns/test_timestamptz.py +0 -0
  273. {piccolo-0.110.0 → piccolo-0.111.0}/tests/columns/test_uuid.py +0 -0
  274. {piccolo-0.110.0 → piccolo-0.111.0}/tests/columns/test_varchar.py +0 -0
  275. {piccolo-0.110.0 → piccolo-0.111.0}/tests/conf/__init__.py +0 -0
  276. {piccolo-0.110.0 → piccolo-0.111.0}/tests/conf/example.py +0 -0
  277. {piccolo-0.110.0 → piccolo-0.111.0}/tests/conf/test_apps.py +0 -0
  278. {piccolo-0.110.0 → piccolo-0.111.0}/tests/engine/__init__.py +0 -0
  279. {piccolo-0.110.0 → piccolo-0.111.0}/tests/engine/test_extra_nodes.py +0 -0
  280. {piccolo-0.110.0 → piccolo-0.111.0}/tests/engine/test_logging.py +0 -0
  281. {piccolo-0.110.0 → piccolo-0.111.0}/tests/engine/test_nested_transaction.py +0 -0
  282. {piccolo-0.110.0 → piccolo-0.111.0}/tests/engine/test_pool.py +0 -0
  283. {piccolo-0.110.0 → piccolo-0.111.0}/tests/engine/test_transaction.py +0 -0
  284. {piccolo-0.110.0 → piccolo-0.111.0}/tests/engine/test_version_parsing.py +0 -0
  285. {piccolo-0.110.0 → piccolo-0.111.0}/tests/example_apps/__init__.py +0 -0
  286. {piccolo-0.110.0 → piccolo-0.111.0}/tests/example_apps/mega/__init__.py +0 -0
  287. {piccolo-0.110.0 → piccolo-0.111.0}/tests/example_apps/mega/piccolo_app.py +0 -0
  288. {piccolo-0.110.0 → piccolo-0.111.0}/tests/example_apps/mega/piccolo_migrations/2021-09-20T21-23-25-698988.py +0 -0
  289. {piccolo-0.110.0 → piccolo-0.111.0}/tests/example_apps/mega/piccolo_migrations/__init__.py +0 -0
  290. {piccolo-0.110.0 → piccolo-0.111.0}/tests/example_apps/mega/tables.py +0 -0
  291. {piccolo-0.110.0 → piccolo-0.111.0}/tests/example_apps/music/__init__.py +0 -0
  292. {piccolo-0.110.0 → piccolo-0.111.0}/tests/example_apps/music/piccolo_app.py +0 -0
  293. {piccolo-0.110.0 → piccolo-0.111.0}/tests/example_apps/music/tables.py +0 -0
  294. {piccolo-0.110.0 → piccolo-0.111.0}/tests/example_apps/music/tables_detailed.py +0 -0
  295. {piccolo-0.110.0 → piccolo-0.111.0}/tests/query/__init__.py +0 -0
  296. {piccolo-0.110.0 → piccolo-0.111.0}/tests/query/mixins/__init__.py +0 -0
  297. {piccolo-0.110.0 → piccolo-0.111.0}/tests/query/mixins/test_columns_delegate.py +0 -0
  298. {piccolo-0.110.0 → piccolo-0.111.0}/tests/query/mixins/test_order_by_delegate.py +0 -0
  299. {piccolo-0.110.0 → piccolo-0.111.0}/tests/query/test_await.py +0 -0
  300. {piccolo-0.110.0 → piccolo-0.111.0}/tests/query/test_camelcase.py +0 -0
  301. {piccolo-0.110.0 → piccolo-0.111.0}/tests/query/test_freeze.py +0 -0
  302. {piccolo-0.110.0 → piccolo-0.111.0}/tests/query/test_gather.py +0 -0
  303. {piccolo-0.110.0 → piccolo-0.111.0}/tests/query/test_querystring.py +0 -0
  304. {piccolo-0.110.0 → piccolo-0.111.0}/tests/query/test_slots.py +0 -0
  305. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/__init__.py +0 -0
  306. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/instance/__init__.py +0 -0
  307. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/instance/test_create.py +0 -0
  308. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/instance/test_get_related.py +0 -0
  309. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/instance/test_get_related_readable.py +0 -0
  310. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/instance/test_instantiate.py +0 -0
  311. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/instance/test_remove.py +0 -0
  312. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/instance/test_save.py +0 -0
  313. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/instance/test_to_dict.py +0 -0
  314. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/test_all_columns.py +0 -0
  315. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/test_alter.py +0 -0
  316. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/test_batch.py +0 -0
  317. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/test_callback.py +0 -0
  318. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/test_constructor.py +0 -0
  319. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/test_count.py +0 -0
  320. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/test_create.py +0 -0
  321. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/test_create_db_tables.py +0 -0
  322. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/test_create_table_class.py +0 -0
  323. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/test_delete.py +0 -0
  324. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/test_drop_db_tables.py +0 -0
  325. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/test_exists.py +0 -0
  326. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/test_from_dict.py +0 -0
  327. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/test_indexes.py +0 -0
  328. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/test_inheritance.py +0 -0
  329. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/test_join.py +0 -0
  330. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/test_join_on.py +0 -0
  331. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/test_metaclass.py +0 -0
  332. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/test_objects.py +0 -0
  333. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/test_output.py +0 -0
  334. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/test_raw.py +0 -0
  335. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/test_ref.py +0 -0
  336. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/test_refresh.py +0 -0
  337. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/test_repr.py +0 -0
  338. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/test_str.py +0 -0
  339. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/test_table_exists.py +0 -0
  340. {piccolo-0.110.0 → piccolo-0.111.0}/tests/table/test_update.py +0 -0
  341. {piccolo-0.110.0 → piccolo-0.111.0}/tests/testing/__init__.py +0 -0
  342. {piccolo-0.110.0 → piccolo-0.111.0}/tests/testing/test_model_builder.py +0 -0
  343. {piccolo-0.110.0 → piccolo-0.111.0}/tests/testing/test_random_builder.py +0 -0
  344. {piccolo-0.110.0 → piccolo-0.111.0}/tests/utils/__init__.py +0 -0
  345. {piccolo-0.110.0 → piccolo-0.111.0}/tests/utils/test_dictionary.py +0 -0
  346. {piccolo-0.110.0 → piccolo-0.111.0}/tests/utils/test_encoding.py +0 -0
  347. {piccolo-0.110.0 → piccolo-0.111.0}/tests/utils/test_lazy_loader.py +0 -0
  348. {piccolo-0.110.0 → piccolo-0.111.0}/tests/utils/test_list.py +0 -0
  349. {piccolo-0.110.0 → piccolo-0.111.0}/tests/utils/test_naming.py +0 -0
  350. {piccolo-0.110.0 → piccolo-0.111.0}/tests/utils/test_printing.py +0 -0
  351. {piccolo-0.110.0 → piccolo-0.111.0}/tests/utils/test_pydantic.py +0 -0
  352. {piccolo-0.110.0 → piccolo-0.111.0}/tests/utils/test_sql_values.py +0 -0
  353. {piccolo-0.110.0 → piccolo-0.111.0}/tests/utils/test_sync.py +0 -0
  354. {piccolo-0.110.0 → piccolo-0.111.0}/tests/utils/test_table_reflection.py +0 -0
  355. {piccolo-0.110.0 → piccolo-0.111.0}/tests/utils/test_warnings.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: piccolo
3
- Version: 0.110.0
3
+ Version: 0.111.0
4
4
  Summary: A fast, user friendly ORM and query builder which supports asyncio.
5
5
  Home-page: https://github.com/piccolo-orm/piccolo
6
6
  Author: Daniel Townsend
@@ -0,0 +1 @@
1
+ __VERSION__ = "0.111.0"
@@ -12,7 +12,7 @@ TEMPLATE_DIR = os.path.join(os.path.dirname(__file__), "templates/app/")
12
12
  SERVERS = ["uvicorn", "Hypercorn"]
13
13
  ROUTERS = ["starlette", "fastapi", "blacksheep", "litestar"]
14
14
  ROUTER_DEPENDENCIES = {
15
- "litestar": ["litestar>=2.0.0a3"],
15
+ "litestar": ["litestar==2.0.0a3"],
16
16
  }
17
17
 
18
18
 
@@ -2,9 +2,16 @@ from __future__ import annotations
2
2
 
3
3
  import typing as t
4
4
 
5
- from piccolo.custom_types import TableInstance
5
+ from typing_extensions import Literal
6
+
7
+ from piccolo.custom_types import Combinable, TableInstance
6
8
  from piccolo.query.base import Query
7
- from piccolo.query.mixins import AddDelegate, ReturningDelegate
9
+ from piccolo.query.mixins import (
10
+ AddDelegate,
11
+ OnConflictAction,
12
+ OnConflictDelegate,
13
+ ReturningDelegate,
14
+ )
8
15
  from piccolo.querystring import QueryString
9
16
 
10
17
  if t.TYPE_CHECKING: # pragma: no cover
@@ -15,7 +22,7 @@ if t.TYPE_CHECKING: # pragma: no cover
15
22
  class Insert(
16
23
  t.Generic[TableInstance], Query[TableInstance, t.List[t.Dict[str, t.Any]]]
17
24
  ):
18
- __slots__ = ("add_delegate", "returning_delegate")
25
+ __slots__ = ("add_delegate", "on_conflict_delegate", "returning_delegate")
19
26
 
20
27
  def __init__(
21
28
  self, table: t.Type[TableInstance], *instances: TableInstance, **kwargs
@@ -23,6 +30,7 @@ class Insert(
23
30
  super().__init__(table, **kwargs)
24
31
  self.add_delegate = AddDelegate()
25
32
  self.returning_delegate = ReturningDelegate()
33
+ self.on_conflict_delegate = OnConflictDelegate()
26
34
  self.add(*instances)
27
35
 
28
36
  ###########################################################################
@@ -36,6 +44,43 @@ class Insert(
36
44
  self.returning_delegate.returning(columns)
37
45
  return self
38
46
 
47
+ def on_conflict(
48
+ self: Self,
49
+ target: t.Optional[t.Union[str, Column, t.Tuple[Column, ...]]] = None,
50
+ action: t.Union[
51
+ OnConflictAction, Literal["DO NOTHING", "DO UPDATE"]
52
+ ] = OnConflictAction.do_nothing,
53
+ values: t.Optional[
54
+ t.Sequence[t.Union[Column, t.Tuple[Column, t.Any]]]
55
+ ] = None,
56
+ where: t.Optional[Combinable] = None,
57
+ ) -> Self:
58
+ if (
59
+ self.engine_type == "sqlite"
60
+ and self.table._meta.db.get_version_sync() < 3.24
61
+ ):
62
+ raise NotImplementedError(
63
+ "SQLite versions lower than 3.24 don't support ON CONFLICT"
64
+ )
65
+
66
+ if (
67
+ self.engine_type in ("postgres", "cockroach")
68
+ and len(self.on_conflict_delegate._on_conflict.on_conflict_items)
69
+ == 1
70
+ ):
71
+ raise NotImplementedError(
72
+ "Postgres and Cockroach only support a single ON CONFLICT "
73
+ "clause."
74
+ )
75
+
76
+ self.on_conflict_delegate.on_conflict(
77
+ target=target,
78
+ action=action,
79
+ values=values,
80
+ where=where,
81
+ )
82
+ return self
83
+
39
84
  ###########################################################################
40
85
 
41
86
  def _raw_response_callback(self, results):
@@ -70,16 +115,27 @@ class Insert(
70
115
 
71
116
  engine_type = self.engine_type
72
117
 
118
+ on_conflict = self.on_conflict_delegate._on_conflict
119
+ if on_conflict.on_conflict_items:
120
+ querystring = QueryString(
121
+ "{}{}",
122
+ querystring,
123
+ on_conflict.querystring,
124
+ query_type="insert",
125
+ table=self.table,
126
+ )
127
+
73
128
  if engine_type in ("postgres", "cockroach") or (
74
129
  engine_type == "sqlite"
75
130
  and self.table._meta.db.get_version_sync() >= 3.35
76
131
  ):
77
- if self.returning_delegate._returning:
132
+ returning = self.returning_delegate._returning
133
+ if returning:
78
134
  return [
79
135
  QueryString(
80
136
  "{}{}",
81
137
  querystring,
82
- self.returning_delegate._returning.querystring,
138
+ returning.querystring,
83
139
  query_type="insert",
84
140
  table=self.table,
85
141
  )
@@ -230,6 +230,8 @@ class Objects(
230
230
  return self
231
231
 
232
232
  def as_of(self, interval: str = "-1s") -> Objects:
233
+ if self.engine_type != "cockroach":
234
+ raise NotImplementedError("Only CockroachDB supports AS OF")
233
235
  self.as_of_delegate.as_of(interval)
234
236
  return self
235
237
 
@@ -356,13 +356,8 @@ class Select(Query[TableInstance, t.List[t.Dict[str, t.Any]]]):
356
356
  def distinct(
357
357
  self: Self, *, on: t.Optional[t.Sequence[Column]] = None
358
358
  ) -> Self:
359
- if on is not None and self.engine_type not in (
360
- "postgres",
361
- "cockroach",
362
- ):
363
- raise ValueError(
364
- "Only Postgres and Cockroach supports DISTINCT ON"
365
- )
359
+ if on is not None and self.engine_type == "sqlite":
360
+ raise NotImplementedError("SQLite doesn't support DISTINCT ON")
366
361
 
367
362
  self.distinct_delegate.distinct(enabled=True, on=on)
368
363
  return self
@@ -377,6 +372,9 @@ class Select(Query[TableInstance, t.List[t.Dict[str, t.Any]]]):
377
372
  return self
378
373
 
379
374
  def as_of(self: Self, interval: str = "-1s") -> Self:
375
+ if self.engine_type != "cockroach":
376
+ raise NotImplementedError("Only CockroachDB supports AS OF")
377
+
380
378
  self.as_of_delegate.as_of(interval)
381
379
  return self
382
380
 
@@ -7,6 +7,8 @@ import typing as t
7
7
  from dataclasses import dataclass, field
8
8
  from enum import Enum, auto
9
9
 
10
+ from typing_extensions import Literal
11
+
10
12
  from piccolo.columns import And, Column, Or, Where
11
13
  from piccolo.columns.column_types import ForeignKey
12
14
  from piccolo.custom_types import Combinable
@@ -581,9 +583,10 @@ class OffsetDelegate:
581
583
 
582
584
  Typically used in conjunction with order_by and limit.
583
585
 
584
- Example usage:
586
+ Example usage::
587
+
588
+ .offset(100)
585
589
 
586
- .offset(100)
587
590
  """
588
591
 
589
592
  _offset: t.Optional[Offset] = None
@@ -613,12 +616,173 @@ class GroupBy:
613
616
  @dataclass
614
617
  class GroupByDelegate:
615
618
  """
616
- Used to group results - needed when doing aggregation.
619
+ Used to group results - needed when doing aggregation::
620
+
621
+ .group_by(Band.name)
617
622
 
618
- .group_by(Band.name)
619
623
  """
620
624
 
621
625
  _group_by: t.Optional[GroupBy] = None
622
626
 
623
627
  def group_by(self, *columns: Column):
624
628
  self._group_by = GroupBy(columns=columns)
629
+
630
+
631
+ class OnConflictAction(str, Enum):
632
+ """
633
+ Specify which action to take on conflict.
634
+ """
635
+
636
+ do_nothing = "DO NOTHING"
637
+ do_update = "DO UPDATE"
638
+
639
+
640
+ @dataclass
641
+ class OnConflictItem:
642
+ target: t.Optional[t.Union[str, Column, t.Tuple[Column, ...]]] = None
643
+ action: t.Optional[OnConflictAction] = None
644
+ values: t.Optional[
645
+ t.Sequence[t.Union[Column, t.Tuple[Column, t.Any]]]
646
+ ] = None
647
+ where: t.Optional[Combinable] = None
648
+
649
+ @property
650
+ def target_string(self) -> str:
651
+ target = self.target
652
+ assert target
653
+
654
+ def to_string(value) -> str:
655
+ if isinstance(value, Column):
656
+ return f'"{value._meta.db_column_name}"'
657
+ else:
658
+ raise ValueError("OnConflict.target isn't a valid type")
659
+
660
+ if isinstance(target, str):
661
+ return f'ON CONSTRAINT "{target}"'
662
+ elif isinstance(target, Column):
663
+ return f"({to_string(target)})"
664
+ elif isinstance(target, tuple):
665
+ columns_str = ", ".join([to_string(i) for i in target])
666
+ return f"({columns_str})"
667
+ else:
668
+ raise ValueError("OnConflict.target isn't a valid type")
669
+
670
+ @property
671
+ def action_string(self) -> QueryString:
672
+ action = self.action
673
+ if isinstance(action, OnConflictAction):
674
+ if action == OnConflictAction.do_nothing:
675
+ return QueryString(OnConflictAction.do_nothing.value)
676
+ elif action == OnConflictAction.do_update:
677
+ values = []
678
+ query = f"{OnConflictAction.do_update.value} SET"
679
+
680
+ if not self.values:
681
+ raise ValueError("No values specified for `on conflict`")
682
+
683
+ for value in self.values:
684
+ if isinstance(value, Column):
685
+ column_name = value._meta.db_column_name
686
+ query += f' "{column_name}"=EXCLUDED."{column_name}",'
687
+ elif isinstance(value, tuple):
688
+ column = value[0]
689
+ value_ = value[1]
690
+ if isinstance(column, Column):
691
+ column_name = column._meta.db_column_name
692
+ else:
693
+ raise ValueError("Unsupported column type")
694
+
695
+ query += f' "{column_name}"={{}},'
696
+ values.append(value_)
697
+
698
+ return QueryString(query.rstrip(","), *values)
699
+
700
+ raise ValueError("OnConflict.action isn't a valid type")
701
+
702
+ @property
703
+ def querystring(self) -> QueryString:
704
+ query = " ON CONFLICT"
705
+ values = []
706
+
707
+ if self.target:
708
+ query += f" {self.target_string}"
709
+
710
+ if self.action:
711
+ query += " {}"
712
+ values.append(self.action_string)
713
+
714
+ if self.where:
715
+ query += " WHERE {}"
716
+ values.append(self.where.querystring)
717
+
718
+ return QueryString(query, *values)
719
+
720
+ def __str__(self) -> str:
721
+ return self.querystring.__str__()
722
+
723
+
724
+ @dataclass
725
+ class OnConflict:
726
+ """
727
+ Multiple `ON CONFLICT` statements are allowed - which is why we have this
728
+ parent class.
729
+ """
730
+
731
+ on_conflict_items: t.List[OnConflictItem] = field(default_factory=list)
732
+
733
+ @property
734
+ def querystring(self) -> QueryString:
735
+ query = "".join("{}" for i in self.on_conflict_items)
736
+ return QueryString(
737
+ query, *[i.querystring for i in self.on_conflict_items]
738
+ )
739
+
740
+ def __str__(self) -> str:
741
+ return self.querystring.__str__()
742
+
743
+
744
+ @dataclass
745
+ class OnConflictDelegate:
746
+ """
747
+ Used with insert queries to specify what to do when a query fails due to
748
+ a constraint::
749
+
750
+ .on_conflict(action='DO NOTHING')
751
+
752
+ .on_conflict(action='DO UPDATE', values=[Band.popularity])
753
+
754
+ .on_conflict(action='DO UPDATE', values=[(Band.popularity, 1)])
755
+
756
+ """
757
+
758
+ _on_conflict: OnConflict = field(default_factory=OnConflict)
759
+
760
+ def on_conflict(
761
+ self,
762
+ target: t.Optional[t.Union[str, Column, t.Tuple[Column, ...]]] = None,
763
+ action: t.Union[
764
+ OnConflictAction, Literal["DO NOTHING", "DO UPDATE"]
765
+ ] = OnConflictAction.do_nothing,
766
+ values: t.Optional[
767
+ t.Sequence[t.Union[Column, t.Tuple[Column, t.Any]]]
768
+ ] = None,
769
+ where: t.Optional[Combinable] = None,
770
+ ):
771
+ action_: OnConflictAction
772
+ if isinstance(action, OnConflictAction):
773
+ action_ = action
774
+ elif isinstance(action, str):
775
+ action_ = OnConflictAction(action.upper())
776
+ else:
777
+ raise ValueError("Unrecognised `on conflict` action.")
778
+
779
+ if where and action_ == OnConflictAction.do_nothing:
780
+ raise ValueError(
781
+ "The `where` option can only be used with DO NOTHING."
782
+ )
783
+
784
+ self._on_conflict.on_conflict_items.append(
785
+ OnConflictItem(
786
+ target=target, action=action_, values=values, where=where
787
+ )
788
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: piccolo
3
- Version: 0.110.0
3
+ Version: 0.111.0
4
4
  Summary: A fast, user friendly ORM and query builder which supports asyncio.
5
5
  Home-page: https://github.com/piccolo-orm/piccolo
6
6
  Author: Daniel Townsend