velocity-python 0.0.152__py3-none-any.whl → 0.0.153__py3-none-any.whl

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.

Potentially problematic release.


This version of velocity-python might be problematic. Click here for more details.

velocity/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = version = "0.0.152"
1
+ __version__ = version = "0.0.153"
2
2
 
3
3
  from . import aws
4
4
  from . import db
velocity/db/core/table.py CHANGED
@@ -347,10 +347,10 @@ class Table:
347
347
  return Row(self, result[0]["sys_id"], lock=lock)
348
348
 
349
349
  @return_default(None)
350
- def find(self, where, lock=None, use_where=False):
350
+ def find(self, where, lock=None, use_where=False, raise_if_missing=False):
351
351
  """
352
- Finds a single row matching `where`, or returns None if none found.
353
- Raises DuplicateRowsFoundError if multiple rows match.
352
+ Finds a single row matching `where`, or returns None if none found unless
353
+ ``raise_if_missing`` is True. Raises DuplicateRowsFoundError if multiple rows match.
354
354
  """
355
355
  if where is None:
356
356
  raise Exception("None is not allowed as a primary key.")
@@ -358,6 +358,10 @@ class Table:
358
358
  where = {"sys_id": where}
359
359
  result = self.select("sys_id", where=where, lock=lock).all()
360
360
  if not result:
361
+ if raise_if_missing:
362
+ raise LookupError(
363
+ f"No rows found in `{self.name}` for criteria: {where!r}"
364
+ )
361
365
  return None
362
366
  if len(result) > 1:
363
367
  sql = self.select("sys_id", sql_only=True, where=where, lock=lock)
@@ -168,9 +168,21 @@ class Transaction:
168
168
  """Shortcut to table.get() with optional ``use_where`` passthrough."""
169
169
  return self.table(tablename).get(where, lock=lock, use_where=use_where)
170
170
 
171
- def find(self, tablename, where, lock=None, use_where=False):
172
- """Shortcut to table.find() with optional ``use_where`` passthrough."""
173
- return self.table(tablename).find(where, lock=lock, use_where=use_where)
171
+ def find(
172
+ self,
173
+ tablename,
174
+ where,
175
+ lock=None,
176
+ use_where=False,
177
+ raise_if_missing=False,
178
+ ):
179
+ """Shortcut to table.find() with ``use_where``/``raise_if_missing`` passthrough."""
180
+ return self.table(tablename).find(
181
+ where,
182
+ lock=lock,
183
+ use_where=use_where,
184
+ raise_if_missing=raise_if_missing,
185
+ )
174
186
 
175
187
  def column(self, tablename, colname):
176
188
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: velocity-python
3
- Version: 0.0.152
3
+ Version: 0.0.153
4
4
  Summary: A rapid application development library for interfacing with data storage
5
5
  Author-email: Velocity Team <info@codeclubs.org>
6
6
  License-Expression: MIT
@@ -1,4 +1,4 @@
1
- velocity/__init__.py,sha256=RyxrnzBhzGp5qsnb1PU0iJPVNsvSTg5ZIlnrnL5P3m4,147
1
+ velocity/__init__.py,sha256=9s-bNUFexw6PJX1-0uXQBwF6tuficIqPpR43ZzohYyo,147
2
2
  velocity/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  velocity/app/invoices.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  velocity/app/orders.py,sha256=C7ewngMpO8nD3ul_82o4FhZBdRkWvJtnuEbEJUKDCno,6151
@@ -37,8 +37,8 @@ velocity/db/core/engine.py,sha256=mNlaFPruHO935phKPVrsxZprGYUvxW-zp2sBcBZ-KCg,20
37
37
  velocity/db/core/result.py,sha256=b0ie3yZAOj9S57x32uFFGKZ95zhImmZ0iXl0X1qYszc,12813
38
38
  velocity/db/core/row.py,sha256=GOWm-HEBPCBwdqMHMBRc41m0Hoht4vRVQLkvdogX1fU,7729
39
39
  velocity/db/core/sequence.py,sha256=VMBc0ZjGnOaWTwKW6xMNTdP8rZ2umQ8ml4fHTTwuGq4,3904
40
- velocity/db/core/table.py,sha256=GyD4quWUGKXOiyZyE_bSESVscSGiCCQOVtixf7snfZ0,41940
41
- velocity/db/core/transaction.py,sha256=VbB6GSdTT1Puy_j1tQnx9Ia3L3GZZFWaGw4xYWzpKAg,6733
40
+ velocity/db/core/table.py,sha256=_OXKXG7abhVUBja-LVlhHcINmMbKZ-VRN_I_FDfbZ9M,42164
41
+ velocity/db/core/transaction.py,sha256=VrEp37b2d_rRDHKYYm-0D0BiVtYZVltM3zooer25Klg,6918
42
42
  velocity/db/servers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
43
43
  velocity/db/servers/tablehelper.py,sha256=Q48ObN5KD_U2sBP0GUcjaQjKeE4Hr351sPQirwQ0_1s,22163
44
44
  velocity/db/servers/base/__init__.py,sha256=5--XJUeEAm7O6Ns2C_ODCr5TjFhdAge-zApZCT0LGTQ,285
@@ -122,8 +122,8 @@ velocity/misc/tests/test_merge.py,sha256=Vm5_jY5cVczw0hZF-3TYzmxFw81heJOJB-dvhCg
122
122
  velocity/misc/tests/test_oconv.py,sha256=fy4DwWGn_v486r2d_3ACpuBD-K1oOngNq1HJCGH7X-M,4694
123
123
  velocity/misc/tests/test_original_error.py,sha256=iWSd18tckOA54LoPQOGV5j9LAz2W-3_ZOwmyZ8-4YQc,1742
124
124
  velocity/misc/tests/test_timer.py,sha256=l9nrF84kHaFofvQYKInJmfoqC01wBhsUB18lVBgXCoo,2758
125
- velocity_python-0.0.152.dist-info/licenses/LICENSE,sha256=aoN245GG8s9oRUU89KNiGTU4_4OtnNmVi4hQeChg6rM,1076
126
- velocity_python-0.0.152.dist-info/METADATA,sha256=eMxsOZlWyZS4ziuZ2_P0T-vC6vr5lcBEXRHA8Yk8w_M,34266
127
- velocity_python-0.0.152.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
128
- velocity_python-0.0.152.dist-info/top_level.txt,sha256=JW2vJPmodgdgSz7H6yoZvnxF8S3fTMIv-YJWCT1sNW0,9
129
- velocity_python-0.0.152.dist-info/RECORD,,
125
+ velocity_python-0.0.153.dist-info/licenses/LICENSE,sha256=aoN245GG8s9oRUU89KNiGTU4_4OtnNmVi4hQeChg6rM,1076
126
+ velocity_python-0.0.153.dist-info/METADATA,sha256=WkqWt5YdgAqOWMGp0ZErqq44s1vA9PDoh-D01hCTOhY,34266
127
+ velocity_python-0.0.153.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
128
+ velocity_python-0.0.153.dist-info/top_level.txt,sha256=JW2vJPmodgdgSz7H6yoZvnxF8S3fTMIv-YJWCT1sNW0,9
129
+ velocity_python-0.0.153.dist-info/RECORD,,