Commits

tbrugz committed aa89523 Draft

dump: adicionado dump de queries

Comments (0)

Files changed (3)

 		</java>
 	</target>
 	
+	<target name="sqldump-queries">
+		<java classpathref="classpath.run" classname="tbrugz.sqldump.SQLDump">
+			<arg value="-propfile=sqldump-queries.properties"/>
+			<arg value="-usesysprop"/>
+		</java>
+	</target>
+
 	<target name="run-transformation" depends="kettle-echo-properties">
 		<java dir="${kettle.home}" jar="${kettle.home}/launcher/launcher.jar" fork="true">
 			<arg value="-main"/>

sql/ue_candidato_valores.sql

+SELECT b.ANO_ELEICAO, e.sigla_uf, 
+	c.cd_cargo, c.ds_cargo,
+	c.id_ue, descricao_ue,
+	b.seq_candidato, c.nm_candidato,
+	c.id_candidato, pc.id_candidato as pc_id_cand,
+	c.COD_SIT_TOT_TURNO,c.DESC_SIT_TOT_TURNO,
+	count(*) as count, sum(vl_bem) as vl_bem, sum(vl_receita) as vl_receita
+FROM tse_candidatos c
+	inner join TSE_CANDIDATOS_BENS b on c.seq_candidato = b.seq_candidato
+	inner join tse_unidade_eleitoral e on c.id_ue = e.id_ue
+	left outer join TSE_PC_RECEITAS_CAND pc on c.id_candidato = pc.id_candidato
+group by b.ANO_ELEICAO, c.id_ue, b.seq_candidato, c.COD_SIT_TOT_TURNO
+--having sum(vl_bem)>0 and sum(vl_receita)>0

sqldump-queries.properties

+
+@includes = ${user.home}/.kettle/kettle.properties
+
+outputdir=output/queries
+
+#sqldump.deleteregularfilesfromdir=${outputdir}
+
+sqldump.processingclasses=SQLQueries
+
+sqldump.datadump.dumpsyntaxes=csv
+sqldump.datadump.writebom=false
+sqldump.datadump.outfilepattern=${outputdir}/${tablename}${partitionby}.${syntaxfileext}
+
+#################################################
+# queries
+#################################################
+
+# queries
+sqldump.queries=q1
+
+# q1
+sqldump.query.q1.name=Q1a
+sqldump.query.q1.sqlfile=sql/ue_candidato_valores.sql
+
+
+############
+
+sqldump.driverclass=${dadostse.conn.dw.CUSTOM_DRIVER_CLASS}
+sqldump.dburl=${dadostse.conn.dw.CUSTOM_URL}
+sqldump.user=${dadostse.conn.dw.username}
+sqldump.password=${dadostse.conn.dw.password}
+