Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Jython code understand

RobeenOct 1 2020

Hi,

I would like to get help understand this piece of jython code. This is used to convert date

from datetime import date,datetime,timedelta
for record in sdc.records: <<------ is sdc an object? From which class? Is records a variable?
try:
for (field,vals) in record.value.iteritems(): << is record an object? what is value/iteritems?
sdc.log.info("{}",vals)
sdc.log.info("{}",type(vals))
if 'Date' in str(type(vals)):
sdc.log.info("Converted: {}", date.fromtimestamp(vals.getTime()+14400 ))
sdc.log.info("After: {}", date.fromtimestamp(vals.getTime()+14400 ))
record[field] = date.fromtimestamp(vals.getTime()+14400 )
sdc.output.write(record)

except Exception as e:

Send record to error

sdc.error.write(record, str(e))

Thanks,

Joe

Comments

Post Details

Added on Oct 1 2020
0 comments
508 views