I have a Talend job that runs a query on a SQL Server database and then writes selected data into a Postgres database. I am using the tMap component to do the mapping. The SQL Server dates are in similar to 2014-01-20 11:34:26.0
(configured as '"yyyy-MM-dd HH:mm:ss.SSS" in Talend) and the Postgres dates yyyy-MM-dd.
When I run the job I get the following exception:
[statistics] connected
Batch entry 0 INSERT INTO "criticalcareepisodes" ("GivenName","FamilyName","height","weight","mrn","id","admissiondate") VALUES ("Adam","Apple",100,200.0,123456,nextval('CriticalCareEpisodes_id_seq'),2009-11-10 21:30:00.000000 +11:00:00) was aborted. Call getNextException to see the cause.
[statistics] disconnected
Job ExtractSLICCriticalCareEpisode ended at 14:06 27/09/2014. [exit code=0]
어떤 이유로 든 날짜가 예상대로 형식화되지 않은 것 같습니다. 예외는 날짜 / 시간을 Postgres Date 유형으로 푸시하려는 것과 상당히 관련이 있습니다. 적어도 나는 그렇게 생각합니다. 나는 여기에서 분명한 것을 놓치고 있다고 확신하지만 어떤 도움을 주시면 감사하겠습니다.
도움이 될만한 이미지를 추가했습니다.
Ken Hampson의 답변 은 문제의 Postgres 부분을 다룹니다. 날짜 필드에 타임 스탬프를 삽입하려고합니다.
The problem is that you're trying to specify the intended format (yyyy-MM-dd) in the date pattern part of the Date type configuration in the schema. Talend actually holds the full date object at all times and the date pattern is merely for formatting purposes with Talend components such as a tLogRow that will then print the date in the format chosen.
To properly convert the date to a formatted string so you can send it to Postgres (which will implicitly convert the string into a date) you need to replace row1.CCDateAdmit
with TalendDate.formatDate("yyyy-MM-dd",row1.CCDateAdmit)
.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다