From 3f2c150b4307ff6846fc2b008cf9da90c0c9713b Mon Sep 17 00:00:00 2001 From: Barak Stout Date: Thu, 6 Jun 2019 14:48:30 -0400 Subject: [PATCH] updated sql --- .../src/main/resources/modified-lar.sql | 165 +++++++++++++----- 1 file changed, 123 insertions(+), 42 deletions(-) diff --git a/modified-lar/src/main/resources/modified-lar.sql b/modified-lar/src/main/resources/modified-lar.sql index 1279faae2f..a0fbe445d1 100644 --- a/modified-lar/src/main/resources/modified-lar.sql +++ b/modified-lar/src/main/resources/modified-lar.sql @@ -1,5 +1,38 @@ -CREATE TABLE hmda_user.modifiedlar2018 -( +-- SCHEMA: hmda_user + +-- DROP SCHEMA hmda_user ; + +CREATE SCHEMA hmda_user AUTHORIZATION hmda_user; + +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 10.6 +-- Dumped by pg_dump version 10.5 + +-- Started on 2019-06-05 11:44:49 EDT + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET client_min_messages = warning; +SET row_security = off; + +SET default_tablespace = ''; + +SET default_with_oids = false; + +-- +-- TOC entry 282 (class 1259 OID 22057) +-- Name: modifiedlar2018; Type: TABLE; Schema: hmda_user; Owner: hmda_user +-- + +CREATE TABLE hmda_user.modifiedlar2018 ( id integer NOT NULL, lei character varying NOT NULL, loan_type integer, @@ -12,28 +45,28 @@ CREATE TABLE hmda_user.modifiedlar2018 state character varying, county character varying, tract character varying, - ethnicity_applicant_1 integer, - ethnicity_applicant_2 integer, - ethnicity_applicant_3 integer, - ethnicity_applicant_4 integer, - ethnicity_applicant_5 integer, - ethnicity_observed_applicant int, - ethnicity_co_applicant_1 integer, - ethnicity_co_applicant_2 integer, - ethnicity_co_applicant_3 integer, - ethnicity_co_applicant_4 integer, - ethnicity_co_applicant_5 integer, - ethnicity_observed_co_applicant int, - race_applicant_1 integer, - race_applicant_2 integer, - race_applicant_3 integer, - race_applicant_4 integer, - race_applicant_5 integer, - race_co_applicant_1 integer, - race_co_applicant_2 integer, - race_co_applicant_3 integer, - race_co_applicant_4 integer, - race_co_applicant_5 integer, + ethnicity_applicant_1 character varying, + ethnicity_applicant_2 character varying, + ethnicity_applicant_3 character varying, + ethnicity_applicant_4 character varying, + ethnicity_applicant_5 character varying, + ethnicity_observed_applicant integer, + ethnicity_co_applicant_1 character varying, + ethnicity_co_applicant_2 character varying, + ethnicity_co_applicant_3 character varying, + ethnicity_co_applicant_4 character varying, + ethnicity_co_applicant_5 character varying, + ethnicity_observed_co_applicant integer, + race_applicant_1 character varying, + race_applicant_2 character varying, + race_applicant_3 character varying, + race_applicant_4 character varying, + race_applicant_5 character varying, + race_co_applicant_1 character varying, + race_co_applicant_2 character varying, + race_co_applicant_3 character varying, + race_co_applicant_4 character varying, + race_co_applicant_5 character varying, race_observed_applicant integer, race_observed_co_applicant integer, sex_applicant integer, @@ -63,7 +96,7 @@ CREATE TABLE hmda_user.modifiedlar2018 interest_rate character varying, payment_penalty character varying, debt_to_incode character varying, - loan_value_ratio character varying, + loan_value_ratio character varying, loan_term character varying, rate_spread_intro character varying, baloon_payment integer, @@ -92,31 +125,79 @@ CREATE TABLE hmda_user.modifiedlar2018 owner_occupied_units character varying, one_to_four_fam_units character varying, msa_md integer, - msa_md_name character varying, loan_flag character varying, - created_at timestamp default current_timestamp, - submission_id character varying + created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP, + submission_id character varying, + msa_md_name character varying, filing_year integer, - conforming_loan_limit character varying + conforming_loan_limit character varying, median_age integer, - median_age_calculated integer, + median_age_calculated character varying, median_income_percentage integer, - percent_median_msa_income integer, + race_categorization character varying, + sex_categorization character varying, + ethnicity_categorization character varying, + uniq_id integer NOT NULL, + percent_median_msa_income character varying, dwelling_category character varying, loan_product_type character varying -) -WITH ( - OIDS = FALSE ); -ALTER TABLE public.modifiedlar2018 - OWNER to postgres; -ALTER TABLE public.modifiedlar2018 - ADD COLUMN race_categorization character varying, - ADD COLUMN sex_categorization character varying; +ALTER TABLE hmda_user.modifiedlar2018 OWNER TO hmda_user; + +-- +-- TOC entry 285 (class 1259 OID 25533) +-- Name: modifiedlar2018_uniq_id_seq; Type: SEQUENCE; Schema: hmda_user; Owner: hmda_user +-- + +CREATE SEQUENCE hmda_user.modifiedlar2018_uniq_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE hmda_user.modifiedlar2018_uniq_id_seq OWNER TO hmda_user; + +-- +-- TOC entry 5570 (class 0 OID 0) +-- Dependencies: 285 +-- Name: modifiedlar2018_uniq_id_seq; Type: SEQUENCE OWNED BY; Schema: hmda_user; Owner: hmda_user +-- + +ALTER SEQUENCE hmda_user.modifiedlar2018_uniq_id_seq OWNED BY hmda_user.modifiedlar2018.uniq_id; + + +-- +-- TOC entry 5433 (class 2604 OID 57438) +-- Name: modifiedlar2018 uniq_id; Type: DEFAULT; Schema: hmda_user; Owner: hmda_user +-- + +ALTER TABLE ONLY hmda_user.modifiedlar2018 ALTER COLUMN uniq_id SET DEFAULT nextval('hmda_user.modifiedlar2018_uniq_id_seq'::regclass); + + +-- +-- TOC entry 5436 (class 2606 OID 25537) +-- Name: modifiedlar2018 modifiedlar2018_pkey; Type: CONSTRAINT; Schema: hmda_user; Owner: hmda_user +-- + +ALTER TABLE ONLY hmda_user.modifiedlar2018 + ADD CONSTRAINT modifiedlar2018_pkey PRIMARY KEY (uniq_id); + + +-- +-- TOC entry 5434 (class 1259 OID 58733) +-- Name: modifiedlar2018_lei_idx; Type: INDEX; Schema: hmda_user; Owner: hmda_user +-- + +CREATE INDEX modifiedlar2018_lei_idx ON hmda_user.modifiedlar2018 USING btree (lei); + -CREATE INDEX ON modifiedlar2018 (lei); +-- Completed on 2019-06-05 11:44:50 EDT -create index on modifiedlar2018prod (race_categorization); -create index on modifiedlar2018prod (action_taken_type); \ No newline at end of file +-- +-- PostgreSQL database dump complete +--