Enum with connector function

Hola Tulip Community!!

I am trying to write a simple connector function that writes to a table that has an enum field. I am trying to pass the variable through as a text variable with the exact text of one of the enum options but I am getting the following error:

SQL Test Error
Error: [500] error: column “event” is of type event_station_enum but expression is of type text

Does anyone know any workarounds here?

Hey @sarah -

Have you explicitly cast the connector input to an enum like in this guide?

'critical'::enum_log_priority 

I have had to this in the past when writing text to datetimetz fields in SQL databases:

insert into schema.table (human_id,session_date)
values(
$Human_id$,
$date$::timestamptz
)

Let me know if this doesn’t work and I can throw together a table to do some more testing on my end.

Pete

I don’t think that works. I am able to create a function that passes the exact the text through but I want to make one connector function that passes all text

This is what I tried

INSERT into tabla
(created_at,updated_at,event,service_id,station_id,user_id)
VALUES(now(),now(),$event$::enum_log_priority, $service_id$, $station_id$, $user_id$)