title: Read FlowFile with Groovy Nifi
body: <p>I try to transform an Avro file to an SQL request. My file is like this : </p>
  
  <pre><code>{
    "type" : "record",
    "name" : "warranty",
    "doc" : "Schema generated by Kite",
    "fields" : [ {
      "name" : "id",
      "type" : "long",
      "doc" : "Type inferred from '1'"
    }, {
      "name" : "train_id",
      "type" : "long",
      "doc" : "Type inferred from '21691'"
    }, {
      "name" : "siemens_nr",
      "type" : "string",
      "doc" : "Type inferred from 'Loco-001'"
    }, {
      "name" : "uic_nr",
      "type" : "long",
      "doc" : "Type inferred from '193901'"
    }, {
      "name" : "Configuration",
      "type" : "string",
      "doc" : "Type inferred from 'ZP28'"
    }, {
      "name" : "Warranty_Status",
      "type" : "string",
      "doc" : "Type inferred from 'Out_of_Warranty'"
    }, {
      "name" : "Warranty_Data_Type",
      "type" : "string",
      "doc" : "Type inferred from 'Real_based_on_preliminary_acceptance_date'"
    }
  </code></pre>
  
  <p>and my code is :</p>
  
  <pre><code>import groovy.json.JsonSlurper
  
  def ff = session.get()
  if(!ff)return
  
  //parse afro schema from flow file content
  def schema = ff.read().withReader("UTF-8"){ new JsonSlurper().parse(it) }
  
  //define type mapping
  def typeMap = [
      "string"            : "varchar(255)",
      "long"              : "numeric(10)",
      [ "null", "string" ]: "varchar(255)",
      [ "null", "long" ]  : "numeric(10)",
  ]
  //build create table statement
  def createTable = "create table ${schema.name} (" +
      schema.fields.collect{ "\n  ${it.name.padRight(39)} ${typeMap[it.type]}" }.join(',') +
      "\n)"
  
  //execute statement through the custom defined property
  //SQL.mydb references http://docs.groovy-lang.org/2.4.10/html/api/groovy/sql/Sql.html object
  SQL.mydb.execute(createTable)
  
  //transfer flow file to success
  REL_SUCCESS &lt;&lt; ff
  </code></pre>
  
  <p>And i got this error :</p>
  
  <pre><code>ERROR nifi.processors.script.ExecuteScript ExecuteScript[id=e65b733e-0161-1000-45f0-3264d6fb51dd] ExecuteSc$ Possible solutions: getId(), find(), grep(), each(groovy.lang.Closure), find(groovy.lang.Closure), grep(java.lang.Object); rolling back session: {} org.apache.nifi.processor.exception.ProcessException: javax.script.ScriptException: javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of m$ Possible solutions: getId(), find(), grep(), each(groovy.lang.Closure), find(groovy.lang.Closure), grep(java.lang.Object) 
  </code></pre>
  
  <p>Can someone help me plz</p>