Skip to content

Commit c1621b4

Browse files
committed
AP-25161: DEBUG - Add DateTimeParameter with validator to reproduce the issue
AP-25161 (Python DateTimeParameter validator called multiple times with different types)
1 parent e3161a7 commit c1621b4

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

src/extension.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
icon_path="../icons/icon.png",
1111
category="/",
1212
)
13-
@knext.input_table(name="Input Data", description="We read data from here")
13+
# @knext.input_table(name="Input Data", description="We read data from here")
1414
# @knext.input_table(name="Tutorial: Input Data 2", description="We also read data from here") ### Tutorial step 11: Uncomment to create a new input port
15-
@knext.output_table(name="Output Data", description="Whatever the node has produced")
15+
# @knext.output_table(name="Output Data", description="Whatever the node has produced")
1616
class TemplateNode:
1717
"""Short one-line description of the node.
1818
Long description of the node.
@@ -40,17 +40,27 @@ class TemplateNode:
4040

4141
# column_param = knext.ColumnParameter(label="label", description="description", port_index=0, column_filter=is_numeric)
4242

43-
def configure(self, configure_context, input_schema_1):
43+
date = knext.DateTimeParameter(
44+
label="Date Parameter",
45+
description="A date time parameter",
46+
default_value="2023-01-01",
47+
)
48+
49+
@date.validator
50+
def validate_date(value):
51+
logging.warning(f"Validating date: {value}, type: {type(value)}")
52+
53+
def configure(self, configure_context):
4454
# def configure(self, configure_context, input_schema_1, input_schema_2): ### Tutorial step 11: Uncomment to configure the new port (and comment out the previous configure header)
45-
return input_schema_1
55+
return []
4656
### Tutorial step 12: Uncomment the following to adjust to the changes we do in this step in the execute method (and comment out the previous return statement)
4757
# return input_schema_1.append(knext.Column(knext.double(), "column2"))
4858
### Tutorial step 13: Uncomment to set a warning for the configuration, which will be shown in the workflow
4959
# configure_context.set_warning("This is a warning during configuration")
5060

51-
def execute(self, exec_context, input_1):
61+
def execute(self, exec_context):
5262
# def execute(self, exec_context, input_1, input_2): ### Tutorial step 11: Uncomment to accept the new port (and comment out the previous execute header)
53-
return input_1
63+
return []
5464
### Tutorial step 12: Uncomment the following lines to work with the new port (and comment out the previous return statement)
5565
# input_1_pandas = input_1.to_pandas() # Transform the input table to some processable format (pandas or pyarrow)
5666
# input_2_pandas = input_2.to_pandas()

0 commit comments

Comments
 (0)