One Star

Can't Map a String into a Postgres Inet datatype

I need to migrate a string field from a mysql table (string type) to a Postgres inet type field. The tPostgresqlOutput is reading the type as object and choking on insert.
I tried to drop a constant into the right side of the Tmap, but that didn't work either. Tested it using direct SQL and it worked fine.
How do I format a string for use as something the Talend thinks is an Object type field? or how to i tell Talend to treat it like a string?
Here's a script to test it:
create table inet_test1 (id int, phone varchar(20), Ip_address varchar(20));
create table inet_test2 (id int, phone varchar(20), Ip_address inet);
insert into inet_test1 values (1, 'Phone1', '192.168.0.10');
insert into inet_test1 values (2, 'Phone2', null);
insert into inet_test1 values (3, 'Phone3', '192.168.0.30');

tPostgresqlInput -> tMap ( map all fields) -> tPostgresqlOutput
(I did the if null check on the mapping too)
Run...
Boom! no workee.
4 REPLIES
One Star

Re: Can't Map a String into a Postgres Inet datatype

still baffled
Moderator

Re: Can't Map a String into a Postgres Inet datatype

Hi,
Could you please upload your component schema setting screenshots into forum so that we can get your situation more precisely.
Do you want to convert the object to a plain string?If so, please have a look at
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Can't Map a String into a Postgres Inet datatype

Not sure what else is needed...
Moderator

Re: Can't Map a String into a Postgres Inet datatype

Hi,
Have you checked Windows-->Preference-->Talend-->Metadata of TalendType and see mapping_Postgres.xml to define the schema correspond with the table in DB.(About the data type mapping between Talend type and db type)?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.