   pop_density integer,
   peak_load_1 integer,
   peak_load_2 integer,
-  CONSTRAINT ego_deu_grid_district_sectors_pkey PRIMARY KEY (id)
+  CONSTRAINT ego_grid_lv_griddistrictsectors_pkey PRIMARY KEY (id)
 );
 
-TRUNCATE TABLE calc_ego_grid_district.ego_deu_grid_district_sectors;
-INSERT INTO calc_ego_grid_district.ego_deu_grid_district_sectors 
+TRUNCATE TABLE model_draft."ego_grid_lv_griddistrictsectors";
+INSERT INTO model_draft."ego_grid_lv_griddistrictsectors" 
 
 -- residential
 SELECT (ST_DUMP(ST_INTERSECTION(ST_UNION(sector1.geom),grid_district.geom))).geom AS geom, grid_district.id AS grid_district_id, grid_district.load_area_id AS load_area_id, 'residential' AS sector
-FROM 	calc_ego_loads.urban_sector_per_grid_district_1_residential AS sector1,
-	calc_ego_grid_district.ego_deu_lv_grid_district AS grid_district
+FROM 	model_draft."ego_osm_sector_per_griddistrict_1_residential" AS sector1,
+	model_draft."ego_grid_lv_grid_district" AS grid_district
 WHERE  ST_INTERSECTS(grid_district.geom,sector1.geom)
 GROUP BY grid_district.id, grid_district.geom, load_area_id
 


-- agricultural
SELECT (ST_DUMP(ST_INTERSECTION(ST_UNION(sector4.geom),grid_district.geom))).geom AS geom, grid_district.id AS grid_district_id, grid_district.load_area_id AS load_area_id, 'agricultural' AS sector
FROM 	calc_ego_loads.urban_sector_per_grid_district_4_agricultural AS sector4,
	calc_ego_grid_district.ego_deu_lv_grid_district AS grid_district
WHERE ST_INTERSECTS(grid_district.geom,sector4.geom)
GROUP BY grid_district.id, grid_district.geom, load_area_id;

-- Gebiete ohne OSM-Tagging
INSERT INTO calc_ego_grid_district.ego_deu_grid_district_sectors (geom,grid_district_id,load_area_id, sector)

SELECT ST_MULTI(ST_DIFFERENCE(districts.geom::geometry(POLYGON,3035),ST_MULTI(ST_UNION (sectors.geom)))) AS geom, districts.id, districts.load_area_id, 'no sector'
FROM calc_ego_grid_district.ego_deu_grid_district_sectors AS sectors,
	calc_ego_grid_district.ego_deu_lv_grid_district AS districts
WHERE districts.id = sectors.grid_district_id
	
GROUP BY districts.geom,districts.id,districts.load_area_id;


		SELECT (ST_AREA(sectors.geom) / ((l_area.sector_area_agricultural)* 10000)) * (peak.agricultural* 1000000) AS peak_load, sectors.id 

		FROM model_draft."ego_grid_lv_griddistrictsectors" AS sectors,
				model_draft."ego_demand_loadarea" AS l_area,
				model_draft."ego_demand_load_area_peak_load" AS peak

		WHERE sectors.sector = 'agricultural'
			AND l_area.id = sectors.load_area_id
