surreal-orm-lite 0.38.0__tar.gz → 0.38.2__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 (63) hide show
  1. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/CHANGELOG.md +9 -0
  2. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/PKG-INFO +8 -8
  3. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/README.md +7 -7
  4. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/pyproject.toml +1 -1
  5. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/__init__.py +1 -1
  6. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/model_ddl.py +5 -3
  7. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/.gitignore +0 -0
  8. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/LICENSE +0 -0
  9. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/Makefile +0 -0
  10. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/_sdk.py +0 -0
  11. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/aggregations.py +0 -0
  12. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/auth.py +0 -0
  13. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/cache.py +0 -0
  14. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/changefeed.py +0 -0
  15. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/concurrency.py +0 -0
  16. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/connection_config.py +0 -0
  17. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/connection_manager.py +0 -0
  18. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/constants.py +0 -0
  19. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/decoding.py +0 -0
  20. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/define_parser.py +0 -0
  21. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/edge.py +0 -0
  22. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/embedded.py +0 -0
  23. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/encoding.py +0 -0
  24. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/enum.py +0 -0
  25. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/exceptions.py +0 -0
  26. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/functions.py +0 -0
  27. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/geo.py +0 -0
  28. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/hybrid.py +0 -0
  29. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/introspection.py +0 -0
  30. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/live.py +0 -0
  31. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/migrations/__init__.py +0 -0
  32. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/migrations/autodetect.py +0 -0
  33. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/migrations/compare.py +0 -0
  34. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/migrations/constants.py +0 -0
  35. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/migrations/executor.py +0 -0
  36. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/migrations/generator.py +0 -0
  37. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/migrations/introspector.py +0 -0
  38. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/migrations/loader.py +0 -0
  39. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/migrations/migration.py +0 -0
  40. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/migrations/operations.py +0 -0
  41. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/migrations/render.py +0 -0
  42. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/migrations/state.py +0 -0
  43. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/model_auth.py +0 -0
  44. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/model_base.py +0 -0
  45. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/model_generator.py +0 -0
  46. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/py.typed +0 -0
  47. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/q.py +0 -0
  48. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/query_set.py +0 -0
  49. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/routing.py +0 -0
  50. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/schema.py +0 -0
  51. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/schema_state.py +0 -0
  52. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/search.py +0 -0
  53. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/signals.py +0 -0
  54. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/subquery.py +0 -0
  55. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/surql_literal.py +0 -0
  56. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/testing/__init__.py +0 -0
  57. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/testing/database.py +0 -0
  58. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/testing/fixtures.py +0 -0
  59. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/time_travel.py +0 -0
  60. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/transaction.py +0 -0
  61. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/types.py +0 -0
  62. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/utils.py +0 -0
  63. {surreal_orm_lite-0.38.0 → surreal_orm_lite-0.38.2}/src/surreal_orm_lite/vector.py +0 -0
@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.38.2] - 2026-10-30
9
+
10
+ ### Fixed
11
+
12
+ - **`define_table()` keeps a stored `DEFAULT ALWAYS`** when the model declares the default: over a
13
+ field stored with `DEFAULT ALWAYS`, it now writes `DEFAULT ALWAYS <model default>`, as the
14
+ migration diff does, instead of dropping `ALWAYS` (#368). A plain stored `DEFAULT`, or none, still
15
+ gives a plain `DEFAULT`. Same on SurrealDB 2.x and 3.x.
16
+
8
17
  ## [0.38.0] - 2026-10-28
9
18
 
10
19
  Migration system: the ORM writes Django-style migration files from the models and applies them,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: surreal-orm-lite
3
- Version: 0.38.0
3
+ Version: 0.38.2
4
4
  Summary: Lightweight Django-style ORM for SurrealDB using the official Python SDK. Async support with Pydantic validation.
5
5
  Project-URL: Homepage, https://github.com/EulogySnowfall/SurrealDB-ORM-lite
6
6
  Project-URL: Documentation, https://github.com/EulogySnowfall/SurrealDB-ORM-lite
@@ -5623,13 +5623,13 @@ What the model declares wins; the rest is kept from the database:
5623
5623
  | `PERMISSIONS` | `permissions`, written whole | the stored ones kept |
5624
5624
  | `DROP` | — | the stored one kept |
5625
5625
 
5626
- | Field clause | Written from the model | Kept from the database |
5627
- | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------- |
5628
- | `TYPE` | always | — |
5629
- | `FLEXIBLE` | as in "Field types" | a stored one, on a kind that holds an object |
5630
- | `DEFAULT` | a constant default of a column that is not optional (a `server_fields` column: only where the database has no `DEFAULT`, `VALUE` or `COMPUTED`) | when the model writes none |
5631
- | `VALUE`, `COMPUTED` | a computed field's expression: `COMPUTED` over a stored `COMPUTED`, else `VALUE` | when the model writes none |
5632
- | `REFERENCE`, `READONLY`, `ASSERT`, `PERMISSIONS`, `COMMENT` | — | always |
5626
+ | Field clause | Written from the model | Kept from the database |
5627
+ | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
5628
+ | `TYPE` | always | — |
5629
+ | `FLEXIBLE` | as in "Field types" | a stored one, on a kind that holds an object |
5630
+ | `DEFAULT` | a constant default of a column that is not optional (a `server_fields` column: only where the database has no `DEFAULT`, `VALUE` or `COMPUTED`) | when the model writes none; a stored `ALWAYS` even when it writes one |
5631
+ | `VALUE`, `COMPUTED` | a computed field's expression: `COMPUTED` over a stored `COMPUTED`, else `VALUE` | when the model writes none |
5632
+ | `REFERENCE`, `READONLY`, `ASSERT`, `PERMISSIONS`, `COMMENT` | — | always |
5633
5633
 
5634
5634
  - Nothing is removed: the table keeps its records, the fields, clauses, indexes and events the model does not declare,
5635
5635
  the views that read it ([section 33](#33-materialized-views-view_query-define_view)), its live queries and its
@@ -5572,13 +5572,13 @@ What the model declares wins; the rest is kept from the database:
5572
5572
  | `PERMISSIONS` | `permissions`, written whole | the stored ones kept |
5573
5573
  | `DROP` | — | the stored one kept |
5574
5574
 
5575
- | Field clause | Written from the model | Kept from the database |
5576
- | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------- |
5577
- | `TYPE` | always | — |
5578
- | `FLEXIBLE` | as in "Field types" | a stored one, on a kind that holds an object |
5579
- | `DEFAULT` | a constant default of a column that is not optional (a `server_fields` column: only where the database has no `DEFAULT`, `VALUE` or `COMPUTED`) | when the model writes none |
5580
- | `VALUE`, `COMPUTED` | a computed field's expression: `COMPUTED` over a stored `COMPUTED`, else `VALUE` | when the model writes none |
5581
- | `REFERENCE`, `READONLY`, `ASSERT`, `PERMISSIONS`, `COMMENT` | — | always |
5575
+ | Field clause | Written from the model | Kept from the database |
5576
+ | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
5577
+ | `TYPE` | always | — |
5578
+ | `FLEXIBLE` | as in "Field types" | a stored one, on a kind that holds an object |
5579
+ | `DEFAULT` | a constant default of a column that is not optional (a `server_fields` column: only where the database has no `DEFAULT`, `VALUE` or `COMPUTED`) | when the model writes none; a stored `ALWAYS` even when it writes one |
5580
+ | `VALUE`, `COMPUTED` | a computed field's expression: `COMPUTED` over a stored `COMPUTED`, else `VALUE` | when the model writes none |
5581
+ | `REFERENCE`, `READONLY`, `ASSERT`, `PERMISSIONS`, `COMMENT` | — | always |
5582
5582
 
5583
5583
  - Nothing is removed: the table keeps its records, the fields, clauses, indexes and events the model does not declare,
5584
5584
  the views that read it ([section 33](#33-materialized-views-view_query-define_view)), its live queries and its
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "surreal-orm-lite"
3
- version = "0.38.0"
3
+ version = "0.38.2"
4
4
  description = "Lightweight Django-style ORM for SurrealDB using the official Python SDK. Async support with Pydantic validation."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -1,4 +1,4 @@
1
- __version__ = "0.38.0"
1
+ __version__ = "0.38.2"
2
2
 
3
3
  from ._sdk import BoundExcluded, BoundIncluded
4
4
  from .aggregations import Aggregation, Avg, Count, Max, Min, Sum
@@ -753,7 +753,8 @@ def field_statement_keeping(
753
753
  - ``REFERENCE[ ON DELETE …]``: the stored one;
754
754
  - ``DEFAULT[ ALWAYS] <expr>``: the column's constant default — for a ``server_fields`` column only when the stored
755
755
  field has no ``DEFAULT``, ``VALUE`` or ``COMPUTED``, so the database's own rule is never replaced —, else the
756
- stored one;
756
+ stored one; ``ALWAYS`` when the stored ``DEFAULT`` is ``ALWAYS``, whichever expression is written (#368), as the
757
+ migration diff keeps it;
757
758
  - ``READONLY``: the stored one;
758
759
  - ``VALUE <expr>``: a computed field's expression, else the stored one;
759
760
  - ``ASSERT <expr>``, ``PERMISSIONS <rules>`` (as :func:`field_permissions_text` renders them), ``COMMENT
@@ -785,11 +786,12 @@ def field_statement_keeping(
785
786
  if on_delete is not None and on_delete.startswith("THEN"):
786
787
  carried.append(on_delete.removeprefix("THEN"))
787
788
  parts.append("REFERENCE" if on_delete is None else f"REFERENCE ON DELETE {on_delete}")
789
+ always = stored.default is not None and stored.default_always
788
790
  if column.default is not None and not (column.server and _has_value_rule(stored)):
789
- parts.append(f"DEFAULT {column.default}")
791
+ parts.append(f"DEFAULT ALWAYS {column.default}" if always else f"DEFAULT {column.default}")
790
792
  elif stored.default is not None:
791
793
  carried.append(stored.default)
792
- parts.append(f"DEFAULT ALWAYS {stored.default}" if stored.default_always else f"DEFAULT {stored.default}")
794
+ parts.append(f"DEFAULT ALWAYS {stored.default}" if always else f"DEFAULT {stored.default}")
793
795
  if stored.readonly:
794
796
  parts.append("READONLY")
795
797
  if column.value is not None: