0

I have trying to create a python transformation in CDAP where I am facing below issue. Request you to kindly check and let me know the update as soon as possible.

Please find the below issue,use case for your reference.

Issue : Configuring stage python is null.

Use case: user is importing data from MYSQL and at python transform we are using sample script and exporting data to File.

Please check the attached screenshot for your reference.

  def transform(record, emitter, context):
            if (record['actor_id'] > 0):
                  tax = record['actor_id'] * 10
                   emitter.emit({
                     'actor_id': record['actor_id'],
                     'tax': tax,
                     'total': record['subtotal'] + tax,
                   })

actor_id is transformed and processed to the next stage.

sai krishna
  • 151
  • 2
  • 11
  • please share the screenshot. its not in the attachment – muTheTechie Jan 25 '19 at 11:55
  • Please find the below link for your reference & screenshot https://groups.google.com/forum/#!topic/cdap-issues/qRI_tIOHWRI – sai krishna Jan 25 '19 at 12:06
  • its showing `Caused by: org.python.core.PySyntaxError: null`. have you followed right `indentation`? its showing some error in indentation ```Check results ============= E111:3:15:indentation is not a multiple of four E111:4:16:indentation is not a multiple of four E113:4:16:unexpected indentation W292:8:18:no newline at end of file ``` please check yourself at http://pep8online.com – muTheTechie Jan 25 '19 at 12:11

1 Answers1

0

Replace your code with

def transform(record, emitter, context):
      if (record['actor_id'] > 0):
        tax = record['actor_id'] * 10
        emitter.emit({
           'actor_id': record['actor_id'],
           'tax': tax,
           'total': record['subtotal'] + tax,
         })

removed unwanted spaces enter image description here

muTheTechie
  • 1,443
  • 17
  • 25