def upload ( self, channel, sl, imarray ):
    """Transfer the array to the database"""

    # and the limits of iteration
    xlimit = (self._ximgsz-1) / self.xcubedim + 1
    ylimit = (self._yimgsz-1) / self.ycubedim + 1

    for y in range(ylimit):
      for x in range(xlimit):

        # each batch is the last slice in a cube
        z = sl/self.zcubedim

        # zindex
        key = zindex.XYZMorton ( [x,y,z] )

        # Create a channel cube
        cube = imagecube.ImageCube8 ( [self.xcubedim, self.ycubedim, self.zcubedim] )

        # data for this key
        cube.data = imarray[:,y*self.ycubedim:(y+1)*self.ycubedim,x*self.xcubedim:(x+1)*self.xcubedim]
        # compress the cube
        npz = cube.toNPZ ()

        # add the cube to the database
        sql = "INSERT INTO " + self.proj.getTable(self.resolution) +  "(channel, zindex, cube) VALUES (%s, %s, %s)"
        try:
          print sql
          #self.cursor.execute ( sql, (channel, key, npz))
        except MySQLdb.Error, e:
          print ((e.args[0], e.args[1], sql) % "Error updating data cube: %d: %s. sql=%s")
          raise 

    self.db.conn.commit()
dataset/ETHPy150Open neurodata/ndstore/ingest/mitra/mitrachannel.py/MitraIngest.upload/swapped operands of `%`