Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import psycopg2
- from config import *
- conn = psycopg2.connect(dbname=dbname, user=user, password=password, host=host)
- cursor = conn.cursor()
- cursor.execute("DROP TABLE reforma_opendata;")
- conn.commit()
- cursor.execute('CREATE TABLE "reforma_opendata" ( "id" SERIAL PRIMARY KEY, "id_ref" integer NOT NULL, "management_organization_id" integer, "region_id" varchar( 40) NOT NULL, "area_id" varchar( 40) NOT NULL, "city_id" varchar( 40) NOT NULL, "street_id" varchar( 40) NOT NULL, "houseguid" varchar( 40) NOT NULL, "built_year" smallint, "exploitation_start_year" smallint, "house_type" varchar(255), "is_alarm" varchar(3), "method_of_forming_overhaul_fund" varchar(255), "floor_count_max" smallint, "floor_count_min" smallint, "entrance_count" smallint, "energy_efficiency" varchar(255), "elevators_count" smallint, "quarters_count" smallint, "living_quarters_count" smallint, "unliving_quarters_count" smallint, "area_total" float, "area_residential" float, "area_non_residential" float, "area_common_property" float, "area_land" float, "parking_square" float, "playground" smallint, "sportsground" smallint, "foundation_type" varchar(255), "floor_type" varchar(255), "wall_material" varchar(255), "basement_area" float, "chute_type" varchar(255), "chute_count" smallint, "electrical_type" varchar(255), "electrical_entries_count" smallint, "heating_type" varchar(255), "hot_water_type" varchar(255), "cold_water_type" varchar(255), "sewerage_type" varchar(255), "sewerage_cesspools_volume" float, "gas_type" varchar(255), "ventilation_type" varchar(255), "firefighting_type" varchar(255), "drainage_type" varchar(255), "project_type" text, "other_beautification" text );')
- conn.commit()
- cursor.execute('CREATE INDEX reforma_opendata_index ON public.reforma_opendata USING btree (houseguid);')
- conn.commit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement