parameters: (uri: str, direction: str = None, sku_id: str = None)
return_statement: return tuple(result)
docstring: Retrieves SKUs with shortages.
  
      Args:
          uri (str):          Database connection string.
          direction (str):    Indication of sort direction.
          sku_id (str):       SKU unique id.
  
      Returns:
          tuple:              Result.
docstring_summary: Retrieves SKUs with shortages.
docstring_tokens: Retrieves SKUs with shortages .
function: def shortage_controller(uri: str, direction: str = None, sku_id: str = None) -> tuple:
      """ Retrieves SKUs with shortages.
  
      Args:
          uri (str):          Database connection string.
          direction (str):    Indication of sort direction.
          sku_id (str):       SKU unique id.
  
      Returns:
          tuple:              Result.
  
  
      """
      meta = MetaData()
      connection = engine(uri)
      inventory_analysis = Table('inventory_analysis', meta, autoload=True, autoload_with=connection)
  
      if direction == 'biggest':
          skus = select([inventory_analysis.columns.sku_id, inventory_analysis.columns.shortage_cost,
                         func.min(inventory_analysis.columns.shortage_rank)])
      else:
          skus = select([inventory_analysis.columns.sku_id, inventory_analysis.columns.shortage_cost,
                         func.max(inventory_analysis.columns.shortage_rank)])
  
      rp = connection.execute(skus)
      result = []
      sku_id = ""
      for i in rp:
          sku_id = str(i['sku_id'])
          result.append((i['sku_id'], i['shortage_cost']))
      rp.close()
      # print(sku_id)
      msk_table = Table('master_sku_list', meta, autoload=True, autoload_with=connection)
      skus = select([msk_table.columns.id, msk_table.columns.sku_id]).where(msk_table.columns.id == sku_id)
      rp = connection.execute(skus)
      for i in rp:
          result.append(i['sku_id'])
      rp.close()
      return tuple(result)
function_tokens: def shortage_controller ( uri : str , direction : str = None , sku_id : str = None ) -> tuple : meta = MetaData ( ) connection = engine ( uri ) inventory_analysis = Table ( 'inventory_analysis' , meta , autoload = True , autoload_with = connection ) if direction == 'biggest' : skus = select ( [ inventory_analysis . columns . sku_id , inventory_analysis . columns . shortage_cost , func . min ( inventory_analysis . columns . shortage_rank ) ] ) else : skus = select ( [ inventory_analysis . columns . sku_id , inventory_analysis . columns . shortage_cost , func . max ( inventory_analysis . columns . shortage_rank ) ] ) rp = connection . execute ( skus ) result = [ ] sku_id = "" for i in rp : sku_id = str ( i [ 'sku_id' ] ) result . append ( ( i [ 'sku_id' ] , i [ 'shortage_cost' ] ) ) rp . close ( ) # print(sku_id) msk_table = Table ( 'master_sku_list' , meta , autoload = True , autoload_with = connection ) skus = select ( [ msk_table . columns . id , msk_table . columns . sku_id ] ) . where ( msk_table . columns . id == sku_id ) rp = connection . execute ( skus ) for i in rp : result . append ( i [ 'sku_id' ] ) rp . close ( ) return tuple ( result )