def import_seed_timeseries(db_url):
    """Import from SEED database

    Parameters
    ----------
    db_url : str
        SEED database url (should be interpretable by SQLAlchemy)

    Returns
    -------
    out : dict
        Dictionary of ConsumptionHistory objects keyed on BuildingSnapshot id
    """
    ENERGY_TYPES = {
        1: "natural_gas",
        2: "electricity",
        3: "fuel_oil",
        4: "fuel_oil_no_1",
        5: "fuel_oil_no_2",
        6: "fuel_oil_no_4",
        7: "fuel_oil_no_5_and_no_6",
        8: "district_steam",
        9: "district_hot_water",
        10: "district_chilled_water",
        11: "propane",
        12: "liquid_propane",
        13: "kerosene",
        14: "diesel",
        15: "coal",
        16: "coal_anthracite",
        17: "coal_bituminous",
        18: "coke",
        19: "wood",
        20: "other",
        21: "water",
    }

    ENERGY_UNITS = {
        1: "kWh",
        2: "therm",
        3: "Wh",
    }

    metadata = MetaData()
    seed_meter = Table('seed_meter', metadata,
        Column('id', Integer, primary_key=True),
        Column('name', String),
        Column('energy_type', Integer),
        Column('energy_units', Integer),
    )
    seed_timeseries = Table('seed_timeseries', metadata,
        Column('id', Integer, primary_key=True),
        Column('meter_id', None, ForeignKey('seed_meter.id')),
        Column('reading', Float),
        Column('cost', Numeric),
        Column('begin_time', TIMESTAMP),
        Column('end_time', TIMESTAMP),
    )
    seed_meter_building_snapshot = Table('seed_meter_building_snapshot', metadata,
        Column('id', Integer, primary_key=True),
        Column('meter_id', None, ForeignKey('seed_meter.id')),
        Column('buildingsnapshot_id', Integer),
    )

    engine = create_engine(db_url)
    conn = engine.connect()
    s = select([seed_meter_building_snapshot])

    building_meters = {}
    for row in conn.execute(s):
        building_id = row["buildingsnapshot_id"]
        meter_id = row["meter_id"]
        if building_meters not in building_id:
            building_meters[building_id] = [meter_id]
        else:
            building_meters[building_id].append(meter_id)
    buildings_data = {}
    for building_id, meter_ids in building_meters.items():
        consumption = []
        for meter_id in meter_ids:
            meters = select([seed_meter]).where(seed_meter.c.id == meter_id)
            meter_row = conn.execute(meters).fetchone()
            fuel_type = ENERGY_TYPES[meter_row["energy_type"]]
            unit_name = ENERGY_UNITS[meter_row["energy_units"]]

            timeseries = select([seed_timeseries]).where(seed_timeseries.c.meter_id == meter_id)

            records = []
            for row in conn.execute(timeseries):
                start = row["begin_time"]
                end = row["end_time"]
                usage = row["reading"]
                record = {"start": start, "end": end, "value": usage}
                records.append(record)
            consumption_data = ConsumptionData(records, fuel_type, unit_name, record_type="arbitrary")
            consumption.append(consumption_data)

        buildings_data[building_id] = consumption

    return buildings_data
dataset/ETHPy150Open impactlab/eemeter/eemeter/importers.py/import_seed_timeseries/swapped operands of `not in`