nuql 0.0.8__tar.gz → 0.0.10__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 (66) hide show
  1. {nuql-0.0.8 → nuql-0.0.10}/LICENSE +2 -2
  2. {nuql-0.0.8 → nuql-0.0.10}/PKG-INFO +2 -2
  3. {nuql-0.0.8 → nuql-0.0.10}/nuql/client.py +12 -3
  4. {nuql-0.0.8 → nuql-0.0.10}/nuql/resources/records/serialiser.py +3 -0
  5. {nuql-0.0.8 → nuql-0.0.10}/nuql/resources/utils/validators.py +15 -0
  6. {nuql-0.0.8 → nuql-0.0.10}/pyproject.toml +3 -3
  7. {nuql-0.0.8 → nuql-0.0.10}/.gitignore +0 -0
  8. {nuql-0.0.8 → nuql-0.0.10}/nuql/__init__.py +0 -0
  9. {nuql-0.0.8 → nuql-0.0.10}/nuql/api/__init__.py +0 -0
  10. {nuql-0.0.8 → nuql-0.0.10}/nuql/api/adapter.py +0 -0
  11. {nuql-0.0.8 → nuql-0.0.10}/nuql/api/batch_get/__init__.py +0 -0
  12. {nuql-0.0.8 → nuql-0.0.10}/nuql/api/batch_get/batch_get.py +0 -0
  13. {nuql-0.0.8 → nuql-0.0.10}/nuql/api/batch_get/queue.py +0 -0
  14. {nuql-0.0.8 → nuql-0.0.10}/nuql/api/batch_write.py +0 -0
  15. {nuql-0.0.8 → nuql-0.0.10}/nuql/api/condition_check.py +0 -0
  16. {nuql-0.0.8 → nuql-0.0.10}/nuql/api/create.py +0 -0
  17. {nuql-0.0.8 → nuql-0.0.10}/nuql/api/delete.py +0 -0
  18. {nuql-0.0.8 → nuql-0.0.10}/nuql/api/get.py +0 -0
  19. {nuql-0.0.8 → nuql-0.0.10}/nuql/api/put_item.py +0 -0
  20. {nuql-0.0.8 → nuql-0.0.10}/nuql/api/put_update.py +0 -0
  21. {nuql-0.0.8 → nuql-0.0.10}/nuql/api/query/__init__.py +0 -0
  22. {nuql-0.0.8 → nuql-0.0.10}/nuql/api/query/condition.py +0 -0
  23. {nuql-0.0.8 → nuql-0.0.10}/nuql/api/query/condition_builder.py +0 -0
  24. {nuql-0.0.8 → nuql-0.0.10}/nuql/api/query/key_condition.py +0 -0
  25. {nuql-0.0.8 → nuql-0.0.10}/nuql/api/query/query.py +0 -0
  26. {nuql-0.0.8 → nuql-0.0.10}/nuql/api/transaction.py +0 -0
  27. {nuql-0.0.8 → nuql-0.0.10}/nuql/api/update/__init__.py +0 -0
  28. {nuql-0.0.8 → nuql-0.0.10}/nuql/api/update/expression_builder.py +0 -0
  29. {nuql-0.0.8 → nuql-0.0.10}/nuql/api/update/update_item.py +0 -0
  30. {nuql-0.0.8 → nuql-0.0.10}/nuql/api/update/utils.py +0 -0
  31. {nuql-0.0.8 → nuql-0.0.10}/nuql/api/upsert.py +0 -0
  32. {nuql-0.0.8 → nuql-0.0.10}/nuql/connection.py +0 -0
  33. {nuql-0.0.8 → nuql-0.0.10}/nuql/exceptions.py +0 -0
  34. {nuql-0.0.8 → nuql-0.0.10}/nuql/fields/__init__.py +0 -0
  35. {nuql-0.0.8 → nuql-0.0.10}/nuql/fields/boolean.py +0 -0
  36. {nuql-0.0.8 → nuql-0.0.10}/nuql/fields/datetime.py +0 -0
  37. {nuql-0.0.8 → nuql-0.0.10}/nuql/fields/datetime_timestamp.py +0 -0
  38. {nuql-0.0.8 → nuql-0.0.10}/nuql/fields/float.py +0 -0
  39. {nuql-0.0.8 → nuql-0.0.10}/nuql/fields/integer.py +0 -0
  40. {nuql-0.0.8 → nuql-0.0.10}/nuql/fields/key.py +0 -0
  41. {nuql-0.0.8 → nuql-0.0.10}/nuql/fields/list.py +0 -0
  42. {nuql-0.0.8 → nuql-0.0.10}/nuql/fields/map.py +0 -0
  43. {nuql-0.0.8 → nuql-0.0.10}/nuql/fields/string.py +0 -0
  44. {nuql-0.0.8 → nuql-0.0.10}/nuql/fields/ulid.py +0 -0
  45. {nuql-0.0.8 → nuql-0.0.10}/nuql/fields/uuid.py +0 -0
  46. {nuql-0.0.8 → nuql-0.0.10}/nuql/generators/__init__.py +0 -0
  47. {nuql-0.0.8 → nuql-0.0.10}/nuql/generators/datetime.py +0 -0
  48. {nuql-0.0.8 → nuql-0.0.10}/nuql/generators/ulid.py +0 -0
  49. {nuql-0.0.8 → nuql-0.0.10}/nuql/generators/uuid.py +0 -0
  50. {nuql-0.0.8 → nuql-0.0.10}/nuql/resources/__init__.py +0 -0
  51. {nuql-0.0.8 → nuql-0.0.10}/nuql/resources/fields/__init__.py +0 -0
  52. {nuql-0.0.8 → nuql-0.0.10}/nuql/resources/fields/field.py +0 -0
  53. {nuql-0.0.8 → nuql-0.0.10}/nuql/resources/fields/field_map.py +0 -0
  54. {nuql-0.0.8 → nuql-0.0.10}/nuql/resources/fields/value.py +0 -0
  55. {nuql-0.0.8 → nuql-0.0.10}/nuql/resources/records/__init__.py +0 -0
  56. {nuql-0.0.8 → nuql-0.0.10}/nuql/resources/records/projections.py +0 -0
  57. {nuql-0.0.8 → nuql-0.0.10}/nuql/resources/records/validator.py +0 -0
  58. {nuql-0.0.8 → nuql-0.0.10}/nuql/resources/tables/__init__.py +0 -0
  59. {nuql-0.0.8 → nuql-0.0.10}/nuql/resources/tables/indexes.py +0 -0
  60. {nuql-0.0.8 → nuql-0.0.10}/nuql/resources/tables/table.py +0 -0
  61. {nuql-0.0.8 → nuql-0.0.10}/nuql/resources/utils/__init__.py +0 -0
  62. {nuql-0.0.8 → nuql-0.0.10}/nuql/resources/utils/dict.py +0 -0
  63. {nuql-0.0.8 → nuql-0.0.10}/nuql/types/__init__.py +0 -0
  64. {nuql-0.0.8 → nuql-0.0.10}/nuql/types/config.py +0 -0
  65. {nuql-0.0.8 → nuql-0.0.10}/nuql/types/fields.py +0 -0
  66. {nuql-0.0.8 → nuql-0.0.10}/nuql/types/serialisation.py +0 -0
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025, Github:lukeshortland
3
+ Copyright (c) 2025, Github:bdo-digital-nz
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
21
+ SOFTWARE.
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nuql
3
- Version: 0.0.8
3
+ Version: 0.0.10
4
4
  Summary: Nuql (pronounced 'nuckle') is a lightweight DynamoDB library for implementing the single table model pattern.
5
5
  License: MIT License
6
6
 
7
- Copyright (c) 2025, Github:lukeshortland
7
+ Copyright (c) 2025, Github:bdo-digital-nz
8
8
 
9
9
  Permission is hereby granted, free of charge, to any person obtaining a copy
10
10
  of this software and associated documentation files (the "Software"), to deal
@@ -35,10 +35,14 @@ class Nuql:
35
35
  if custom_fields is None:
36
36
  custom_fields = []
37
37
 
38
+ if not isinstance(global_fields, dict):
39
+ global_fields = {}
40
+
41
+ global_fields['nuql:type'] = {'type': 'string'}
42
+
38
43
  # Insert global fields on to all tables
39
- if isinstance(global_fields, dict):
40
- for table_name in list(schema.keys()):
41
- schema[table_name].update(global_fields)
44
+ for table_name in list(schema.keys()):
45
+ schema[table_name].update(global_fields)
42
46
 
43
47
  self.connection = Connection(name, session)
44
48
  self.fields = custom_fields
@@ -47,6 +51,11 @@ class Nuql:
47
51
 
48
52
  resources.validate_schema(self.__schema, self.fields)
49
53
 
54
+ def __getattr__(self, name: str) -> 'resources.Table':
55
+ if name in self.__schema:
56
+ return self.get_table(name)
57
+ raise AttributeError(f'\'{self.__class__.__name__}\' object has no attribute \'{name}\'')
58
+
50
59
  @property
51
60
  def indexes(self) -> 'resources.Indexes':
52
61
  return self.__indexes
@@ -48,6 +48,9 @@ class Serialiser:
48
48
  if not isinstance(data, dict):
49
49
  data = {}
50
50
 
51
+ if action != 'query' and isinstance(self.parent, resources.Table):
52
+ data['nuql:type'] = self.parent.name
53
+
51
54
  # Serialise provided fields
52
55
  for key, deserialised_value in data.items():
53
56
  field = self.get_field(key)
@@ -1,6 +1,8 @@
1
1
  __all__ = ['validate_condition_dict', 'validate_schema']
2
2
 
3
3
  import inspect
4
+ import re
5
+ import keyword
4
6
  from typing import Dict, Any, List, Type
5
7
 
6
8
  import nuql
@@ -161,5 +163,18 @@ def validate_schema(schema: Dict[str, Any], fields: List[Type['types.FieldType']
161
163
  'message': 'Table name in schema must be a string.',
162
164
  }])
163
165
 
166
+ # Validate table name format and reserved keywords
167
+ if not re.match(r'^[a-zA-Z_][a-zA-Z0-9_]*$', table_name):
168
+ raise nuql.ValidationError([{
169
+ 'name': 'schema.table_name',
170
+ 'message': f'Table name \'{table_name}\' must match pattern ^[a-zA-Z_][a-zA-Z0-9_]*$.',
171
+ }])
172
+
173
+ if keyword.iskeyword(table_name):
174
+ raise nuql.ValidationError([{
175
+ 'name': 'schema.table_name',
176
+ 'message': f'Table name \'{table_name}\' is a reserved keyword.',
177
+ }])
178
+
164
179
  # Validate table schema
165
180
  validate_table(table_name, config, fields)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "nuql"
3
- version = "0.0.8"
3
+ version = "0.0.10"
4
4
  description = "Nuql (pronounced 'nuckle') is a lightweight DynamoDB library for implementing the single table model pattern."
5
5
  requires-python = ">=3.13"
6
6
  dependencies = [
@@ -36,5 +36,5 @@ testing = [
36
36
  include = ["nuql/**/*"]
37
37
 
38
38
  [project.url]
39
- Homepage = "https://github.com/lukeshortland/nuql"
40
- Issues = "https://github.com/lukeshortland/nuql/issues"
39
+ Homepage = "https://github.com/bdo-digital-nz/nuql"
40
+ Issues = "https://github.com/bdo-digital-nz/nuql/issues"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes