Ask Your Question
0

In what repo can I find this class/interface

asked 2020-08-20 12:29:21 -0600

aberezin gravatar image

I have the following jython script in a stage set of SDC Records (not native)

from com.streamsets.pipeline.api import Field

for record in records:
    try:
        for attr in record.attributes:
            sdc.log.info("alan:{}".format(record))
        sdc.output.write(record)

    except Exception as e:
        # Send record to error
        sdc.error.write(record, str(e))

And I get this error in my error records

SCRIPTING_04 - Script sent record to error: 'com.streamsets.pipeline.stage.util.scripting.SdcSc' object has no attribute 'attributes'

My question is, in what git repo this this (so I can look at it and know what objects are available)

com.streamsets.pipeline.stage.util.scripting.SdcSc
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-08-21 08:21:06 -0600

iamontheinet gravatar image

Hi!

I am not entirely sure where that is coming from or what you're trying to accomplish with for attr in record.attributes: but see if this code snippet helps. Basically it is looping through all the fields in records of type Data Collector Records and accessing their values.

from com.streamsets.pipeline.api import Field

for record in sdc.records:
  try:

    for field in record.sdcRecord.escapedFieldPathsOrdered:
      sdc.log.info("********* {}".format(record.sdcRecord.get(field)))

    # Write record to processor output
    sdc.output.write(record)
  except Exception as e:
    # Send record to error
    sdc.error.write(record, str(e))

And the interface you should be looking at is this -- https://github.com/streamsets/datacol...

Hope this helps.

Cheers, Dash

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2020-08-20 12:29:21 -0600

Seen: 77 times

Last updated: Aug 21