@@ -91,6 +91,8 @@ def init(self, conf: ConfigTree) -> None:
91
91
self ._publish_reverse_relationships : bool = conf .get_bool (PublishBehaviorConfigs .PUBLISH_REVERSE_RELATIONSHIPS )
92
92
self ._preserve_adhoc_ui_data = conf .get_bool (PublishBehaviorConfigs .PRESERVE_ADHOC_UI_DATA )
93
93
self ._preserve_empty_props : bool = conf .get_bool (PublishBehaviorConfigs .PRESERVE_EMPTY_PROPS )
94
+ self ._prop_types_to_configure : Dict = \
95
+ dict (conf .get (Neo4jCsvPublisherConfigs .NEO4J_PROP_TYPES_TO_CONFIGURE , default = {}))
94
96
if self ._add_publisher_metadata and not self ._publish_tag :
95
97
raise Exception (f'{ PublisherConfigs .JOB_PUBLISH_TAG } should not be empty' )
96
98
@@ -317,23 +319,38 @@ def _create_props_body(self,
317
319
template = Template ("""
318
320
{% for k in record_keys %}
319
321
{% if preserve_empty_props %}
320
- {{ identifier }}.{{ k }} = row.{{ k }}
322
+ {% if k in prop_types_to_configure %}
323
+ {{ identifier }}.{{ k }} = {{ prop_types_to_configure[k] }}(row.{{ k }})
324
+ {% else %}
325
+ {{ identifier }}.{{ k }} = row.{{ k }}
326
+ {% endif %}
321
327
{% else %}
322
- {{ identifier }}.{{ k }} = (CASE row.{{ k }} WHEN '' THEN NULL ELSE row.{{ k }} END)
328
+ {% if k in prop_types_to_configure %}
329
+ {{ identifier }}.{{ k }} =
330
+ (CASE row.{{ k }} WHEN '' THEN NULL ELSE {{ prop_types_to_configure[k] }}(row.{{ k }}) END)
331
+ {% else %}
332
+ {{ identifier }}.{{ k }} = (CASE row.{{ k }} WHEN '' THEN NULL ELSE row.{{ k }} END)
333
+ {% endif %}
323
334
{% endif %}
324
335
{{ ", " if not loop.last else "" }}
325
336
{% endfor %}
326
337
{% if record_keys and add_publisher_metadata %}
327
338
,
328
339
{% endif %}
329
340
{% if add_publisher_metadata %}
330
- {{ identifier }}.{{ published_tag_prop }} = '{{ publish_tag }}',
341
+ {% if published_tag_prop in prop_types_to_configure %}
342
+ {{ identifier }}.{{ published_tag_prop }} =
343
+ {{ prop_types_to_configure[published_tag_prop] }}('{{ publish_tag }}'),
344
+ {% else %}
345
+ {{ identifier }}.{{ published_tag_prop }} = '{{ publish_tag }}',
346
+ {% endif %}
331
347
{{ identifier }}.{{ last_updated_prop }} = timestamp()
332
348
{% endif %}
333
349
""" )
334
350
335
351
props_body = template .render (record_keys = record_keys ,
336
352
preserve_empty_props = self ._preserve_empty_props ,
353
+ prop_types_to_configure = self ._prop_types_to_configure ,
337
354
identifier = identifier ,
338
355
add_publisher_metadata = self ._add_publisher_metadata ,
339
356
published_tag_prop = PublisherConfigs .PUBLISHED_TAG_PROPERTY_NAME ,
0 commit comments