Rename _insert__ attributes to _write__

This commit is contained in:
XANTRONIX Industrial 2025-02-14 15:31:50 -05:00
parent 76989f10e9
commit 8a0cbfcd6b
2 changed files with 5 additions and 5 deletions

View file

@ -119,7 +119,7 @@ class Database():
return ret return ret
def value_placeholders(self, table, obj) -> list: def value_placeholders(self, table, obj) -> list:
ci = getattr(table, '__columns_insert__', None) ci = getattr(table, '__columns_write__', None)
if ci is None: if ci is None:
return [f':{c}' for c in table.__columns__] return [f':{c}' for c in table.__columns__]
@ -141,7 +141,7 @@ class Database():
def row_values(self, table, obj) -> dict: def row_values(self, table, obj) -> dict:
ret = dict() ret = dict()
vi = getattr(table, '__values_insert__', None) vi = getattr(table, '__values_write__', None)
if vi is None: if vi is None:
for c in table.__columns__: for c in table.__columns__:
@ -194,7 +194,7 @@ class Database():
table.__key__: getattr(obj, table.__key__) table.__key__: getattr(obj, table.__key__)
} }
vi = getattr(table, '__values_insert__', None) vi = getattr(table, '__values_write__', None)
for k in dirty: for k in dirty:
if vi is not None and k in vi: if vi is not None and k in vi:

View file

@ -102,12 +102,12 @@ class StormReport(DatabaseTable):
'coord_end': 'ST_AsText(coord_end) as coord_end' 'coord_end': 'ST_AsText(coord_end) as coord_end'
} }
__columns_insert__ = { __columns_write__ = {
'coord_start': 'MakePoint(:coord_start_lon, :coord_start_lat, {crs})'.format(crs=COORD_SYSTEM), 'coord_start': 'MakePoint(:coord_start_lon, :coord_start_lat, {crs})'.format(crs=COORD_SYSTEM),
'coord_end': 'MakePoint(:coord_end_lon, :coord_end_lat, {crs})'.format(crs=COORD_SYSTEM) 'coord_end': 'MakePoint(:coord_end_lon, :coord_end_lat, {crs})'.format(crs=COORD_SYSTEM)
} }
__values_insert__ = { __values_write__ = {
'coord_start': lambda v: {'coord_start_lon': v.lon, 'coord_start_lat': v.lat}, 'coord_start': lambda v: {'coord_start_lon': v.lon, 'coord_start_lat': v.lat},
'coord_end': lambda v: {'coord_end_lon': v.lon, 'coord_end_lat': v.lat} 'coord_end': lambda v: {'coord_end_lon': v.lon, 'coord_end_lat': v.lat}
} }