Commits

tbrugz committed 577627c Draft

jobs: removendo/adicionando FKs no inicio/final de transformações

Comments (0)

Files changed (4)

 ordem normal de execução dos jobs/transformaçőes:
 
 - `job_eleicoes_basico`
+- `job_eleicoes_candidatos` (parametros: *uf* e *ano*)
+- `job_eleicoes_bem_candidatos` (parametros: *uf* e *ano*)
+- `job_eleicoes_votacao` (parametros: *uf* e *ano*)
+- `job_eleicoes_prestacao_contas` (parametros: *uf* e *ano*)
+
+jobs que incluem outros jobs:
+
 - `job_eleicoes_uf` (parametros: *uf* e *ano*) (inclui: `job_eleicoes_candidatos`, `job_eleicoes_bem_candidatos` e `job_eleicoes_votacao`)
-- `job_eleicoes_prestacao_contas` (parametros: *uf* e *ano*)
 
 
 prĂŠ-requisitos

kettle/repositorio-de-dados-eleitorais/job_eleicoes_bem_candidatos.kjb

     <parameters>
         <parameter>
             <name>dadostse.carga.anoeleicao</name>
-            <default_value>2010</default_value>
+            <default_value>2012</default_value>
             <description/>
         </parameter>
         <parameter>
             <description/>
         </parameter>
     </parameters>
+  <connection>
+    <name>dw_tse</name>
+    <server>${dadostse.conn.dw.server}</server>
+    <type>GENERIC</type>
+    <access>Native</access>
+    <database>${dadostse.conn.dw.database}</database>
+    <port>${dadostse.conn.dw.port}</port>
+    <username>${dadostse.conn.dw.username}</username>
+    <password>${dadostse.conn.dw.password}</password>
+    <servername/>
+    <data_tablespace/>
+    <index_tablespace/>
+    <attributes>
+      <attribute><code>CUSTOM_DRIVER_CLASS</code><attribute>${dadostse.conn.dw.CUSTOM_DRIVER_CLASS}</attribute></attribute>
+      <attribute><code>CUSTOM_URL</code><attribute>${dadostse.conn.dw.CUSTOM_URL}</attribute></attribute>
+      <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
+      <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
+      <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
+      <attribute><code>PORT_NUMBER</code><attribute>${dadostse.conn.dw.port}</attribute></attribute>
+      <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
+      <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>N</attribute></attribute>
+      <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
+    </attributes>
+  </connection>
     <slaveservers>
     </slaveservers>
 <job-log-table><connection/>
       <xloc>261</xloc>
       <yloc>375</yloc>
       </entry>
+    <entry>
+      <name>drop FKs</name>
+      <description/>
+      <type>SQL</type>
+      <sql>alter table tse_candidatos_bens	drop constraint bens_tipos_fk
+</sql>
+      <useVariableSubstitution>F</useVariableSubstitution>
+      <sqlfromfile>F</sqlfromfile>
+      <sqlfilename/>
+      <sendOneStatement>F</sendOneStatement>
+      <connection>dw_tse</connection>
+      <parallel>N</parallel>
+      <draw>Y</draw>
+      <nr>0</nr>
+      <xloc>155</xloc>
+      <yloc>331</yloc>
+      </entry>
+    <entry>
+      <name>add FKs</name>
+      <description/>
+      <type>SQL</type>
+      <sql>alter table tse_candidatos_bens
+	add constraint bens_tipos_fk foreign key (cd_tipo_bem)
+	references tse_tipos_bens (cd_tipo_bem);</sql>
+      <useVariableSubstitution>F</useVariableSubstitution>
+      <sqlfromfile>F</sqlfromfile>
+      <sqlfilename/>
+      <sendOneStatement>F</sendOneStatement>
+      <connection>dw_tse</connection>
+      <parallel>N</parallel>
+      <draw>Y</draw>
+      <nr>0</nr>
+      <xloc>512</xloc>
+      <yloc>293</yloc>
+      </entry>
   </entries>
   <hops>
     <hop>
     </hop>
     <hop>
       <from>START</from>
+      <to>drop FKs</to>
+      <from_nr>0</from_nr>
+      <to_nr>0</to_nr>
+      <enabled>Y</enabled>
+      <evaluation>Y</evaluation>
+      <unconditional>Y</unconditional>
+    </hop>
+    <hop>
+      <from>drop FKs</from>
       <to>delete_tse_candidatos_bens</to>
       <from_nr>0</from_nr>
       <to_nr>0</to_nr>
     </hop>
     <hop>
       <from>bens candidato [CANDBEM]</from>
+      <to>add FKs</to>
+      <from_nr>0</from_nr>
+      <to_nr>0</to_nr>
+      <enabled>Y</enabled>
+      <evaluation>Y</evaluation>
+      <unconditional>Y</unconditional>
+    </hop>
+    <hop>
+      <from>add FKs</from>
       <to>Success</to>
       <from_nr>0</from_nr>
       <to_nr>0</to_nr>
       <enabled>Y</enabled>
       <evaluation>Y</evaluation>
-      <unconditional>N</unconditional>
+      <unconditional>Y</unconditional>
     </hop>
   </hops>
   <notepads>

kettle/repositorio-de-dados-eleitorais/job_eleicoes_candidatos.kjb

     <parameters>
         <parameter>
             <name>dadostse.carga.anoeleicao</name>
-            <default_value>2010</default_value>
+            <default_value>2012</default_value>
             <description/>
         </parameter>
         <parameter>
             <description/>
         </parameter>
     </parameters>
+  <connection>
+    <name>dw_tse</name>
+    <server>${dadostse.conn.dw.server}</server>
+    <type>GENERIC</type>
+    <access>Native</access>
+    <database>${dadostse.conn.dw.database}</database>
+    <port>${dadostse.conn.dw.port}</port>
+    <username>${dadostse.conn.dw.username}</username>
+    <password>${dadostse.conn.dw.password}</password>
+    <servername/>
+    <data_tablespace/>
+    <index_tablespace/>
+    <attributes>
+      <attribute><code>CUSTOM_DRIVER_CLASS</code><attribute>${dadostse.conn.dw.CUSTOM_DRIVER_CLASS}</attribute></attribute>
+      <attribute><code>CUSTOM_URL</code><attribute>${dadostse.conn.dw.CUSTOM_URL}</attribute></attribute>
+      <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
+      <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
+      <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
+      <attribute><code>PORT_NUMBER</code><attribute>${dadostse.conn.dw.port}</attribute></attribute>
+      <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
+      <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>N</attribute></attribute>
+      <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
+    </attributes>
+  </connection>
     <slaveservers>
     </slaveservers>
 <job-log-table><connection/>
       <xloc>142</xloc>
       <yloc>137</yloc>
       </entry>
+    <entry>
+      <name>drop FKs</name>
+      <description/>
+      <type>SQL</type>
+      <sql>alter table tse_candidatos
+	drop constraint cand_politico_fk</sql>
+      <useVariableSubstitution>F</useVariableSubstitution>
+      <sqlfromfile>F</sqlfromfile>
+      <sqlfilename/>
+      <sendOneStatement>F</sendOneStatement>
+      <connection>dw_tse</connection>
+      <parallel>N</parallel>
+      <draw>Y</draw>
+      <nr>0</nr>
+      <xloc>205</xloc>
+      <yloc>390</yloc>
+      </entry>
+    <entry>
+      <name>add FKs</name>
+      <description/>
+      <type>SQL</type>
+      <sql>alter table tse_candidatos
+	add constraint cand_politico_fk foreign key (num_titulo_eleitoral_candidato)
+	references tse_politicos (num_titulo_eleitoral_candidato);</sql>
+      <useVariableSubstitution>F</useVariableSubstitution>
+      <sqlfromfile>F</sqlfromfile>
+      <sqlfilename/>
+      <sendOneStatement>F</sendOneStatement>
+      <connection>dw_tse</connection>
+      <parallel>N</parallel>
+      <draw>Y</draw>
+      <nr>0</nr>
+      <xloc>336</xloc>
+      <yloc>380</yloc>
+      </entry>
   </entries>
   <hops>
     <hop>
       <unconditional>N</unconditional>
     </hop>
     <hop>
-      <from>partidos_invalidos</from>
-      <to>tse_candidatos [LISTACAND]</to>
-      <from_nr>0</from_nr>
-      <to_nr>0</to_nr>
-      <enabled>Y</enabled>
-      <evaluation>Y</evaluation>
-      <unconditional>N</unconditional>
-    </hop>
-    <hop>
       <from>START</from>
       <to>ue [LISTACAND]</to>
       <from_nr>0</from_nr>
       <unconditional>N</unconditional>
     </hop>
     <hop>
+      <from>partidos_invalidos</from>
+      <to>drop FKs</to>
+      <from_nr>0</from_nr>
+      <to_nr>0</to_nr>
+      <enabled>Y</enabled>
+      <evaluation>Y</evaluation>
+      <unconditional>N</unconditional>
+    </hop>
+    <hop>
+      <from>drop FKs</from>
+      <to>tse_candidatos [LISTACAND]</to>
+      <from_nr>0</from_nr>
+      <to_nr>0</to_nr>
+      <enabled>Y</enabled>
+      <evaluation>Y</evaluation>
+      <unconditional>N</unconditional>
+    </hop>
+    <hop>
       <from>tse_candidatos [LISTACAND]</from>
+      <to>add FKs</to>
+      <from_nr>0</from_nr>
+      <to_nr>0</to_nr>
+      <enabled>Y</enabled>
+      <evaluation>Y</evaluation>
+      <unconditional>N</unconditional>
+    </hop>
+    <hop>
+      <from>add FKs</from>
       <to>candidatos_invalidos</to>
       <from_nr>0</from_nr>
       <to_nr>0</to_nr>

modelo/TABLEs.sql

 	nome_doador varchar(100),
 	data_receita timestamp,
 	tipo_receita varchar(37),
-	ds_receita varchar(300)
+	ds_receita varchar(300),
+	ano_eleicao smallint
 );
 
 create table tse_perfil_eleitorado ( -- type=TABLE
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.