Exemplo n.º 1
0
def main():
    sql = """
        SELECT * FROM user_feature ORDER BY created_on DESC;
        """

    results = db_fetch_many(sql)
    db_table_format_result(result)

    for result in results:
        print((("|%s" * len(result)) + '|') % result)
def main():
  sql = """
        SELECT * FROM user_feature ORDER BY created_on DESC;
        """
        
  results = db_fetch_many(sql)  
  db_table_format_result( result )

  for result in results:    
    print( (("|%s" * len(result))+'|' ) % result )
Exemplo n.º 3
0
def main():
  sql = """
        SELECT tc.name,  vr.name, dovr.delivery_origin_id, dor.delivery_origin_code
        FROM vehicle_resource vr 
        RIGHT JOIN delivery_origin_vehicle_resource dovr 
        ON vr.vehicle_resource_id = dovr.vehicle_resource_id
        LEFT JOIN delivery_origin dor 
        ON dovr.delivery_origin_id = dor.delivery_origin_id
        LEFT JOIN transport_company tc 
        ON tc.transport_company_id = vr.transport_company_id
        ORDER BY vr.name ASC;
        """
        
  results = db_fetch_many(sql)  

  for result in results:
    print("|%25s|%25s|%15s|%15s|" % result)
Exemplo n.º 4
0
def main():
    sql = """
        SELECT rail_car_id, car_number, sort_order FROM rail_car WHERE train_id = (
          SELECT train_id FROM delivery_order WHERE delivery_order_id = 2964952
        ) ORDER BY sort_order ASC;
        """

    sql = """
        SELECT rail_car_id, car_number, sort_order FROM rail_car 
        WHERE train_id = 701
        ORDER BY sort_order ASC;  
        """

    results = db_fetch_many(sql)

    for result in results:
        print("|%3s|%10s|%3s|" % result)
def main():
  sql = """
        select mp.package_name, mpl.url, mpl.size, mpl.name from map_package_layer mpl 
        right join map_package mp on mpl.map_package_id = mp.map_package_id
        where mp.grid_version = 2 order by mp.package_name, mpl.name;
        """
        
  results = db_fetch_many(sql)  

  total_size = 0

  for result in results:            
    total_size += result[2]
    formatted = (result[0], result[3], result[1], "%.2f" % ( float(result[2]) / 2**20,) )     
    print( (("|%s" * len(result))+'|' ) % formatted )
    
  print( "Total size: %s" % (humanize_bytes(total_size)))
Exemplo n.º 6
0
def main():
    sql = """
        SELECT tc.name,  vr.name, dovr.delivery_origin_id, dor.delivery_origin_code
        FROM vehicle_resource vr 
        RIGHT JOIN delivery_origin_vehicle_resource dovr 
        ON vr.vehicle_resource_id = dovr.vehicle_resource_id
        LEFT JOIN delivery_origin dor 
        ON dovr.delivery_origin_id = dor.delivery_origin_id
        LEFT JOIN transport_company tc 
        ON tc.transport_company_id = vr.transport_company_id
        ORDER BY vr.name ASC;
        """

    results = db_fetch_many(sql)

    for result in results:
        print("|%25s|%25s|%15s|%15s|" % result)
Exemplo n.º 7
0
def main():
  sql = """
        SELECT rail_car_id, car_number, sort_order FROM rail_car WHERE train_id = (
          SELECT train_id FROM delivery_order WHERE delivery_order_id = 2964952
        ) ORDER BY sort_order ASC;
        """

  sql = """
        SELECT rail_car_id, car_number, sort_order FROM rail_car 
        WHERE train_id = 701
        ORDER BY sort_order ASC;  
        """
        
  results = db_fetch_many(sql)  

  for result in results:
    print("|%3s|%10s|%3s|" % result)
Exemplo n.º 8
0
def main():
    sql = """
        select mp.package_name, mpl.url, mpl.size, mpl.name from map_package_layer mpl 
        right join map_package mp on mpl.map_package_id = mp.map_package_id
        where mp.grid_version = 2 order by mp.package_name, mpl.name;
        """

    results = db_fetch_many(sql)

    total_size = 0

    for result in results:
        total_size += result[2]
        formatted = (result[0], result[3], result[1],
                     "%.2f" % (float(result[2]) / 2**20, ))
        print((("|%s" * len(result)) + '|') % formatted)

    print("Total size: %s" % (humanize_bytes(total_size)))