• Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » Loading a txt file without loading certain lines in a table oracle

#1 2011-12-06 01:33:24

oscarmsanz
Member
Registered: 1970-01-01
Posts: 78

Loading a txt file without loading certain lines in a table oracle

I have to load a txt file like this on an oracle table. I am using opend studio version 5.0


xxxxxxxxxxxxxxxxxxxxxxxxxxx
ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ

DNI: 50112031E
Name: Oscar
Age: 33

yyyyyyyyyyyyyyyyyyyyyyyyyyy
jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj

country: Spain
Province: Madrid

I just load the values ​​of DNI, name, age, country, province and the rest discarded.

Oracle table has the following fields: DNI, name, age, country province.

How I can load this file into the oracle table?

Regards,
Oscar Manso Sanz

Offline

#2 2011-12-06 07:36:26

pedro
Member
Registered: 2011-11-17
Posts: 3682

Re: Loading a txt file without loading certain lines in a table oracle

Hi
You mean you have txt file like this:
DNI:50112031E
Name:Oscar
Age: 33
Hobby: Music
Country : Spain
Province: Madrid
....
And you want to change it into this pattern and save them into databse:
DNI               Name   Age   Country  Province
50112031E     Oscar   33     Spain     Madrid
Is it right?
I need to confirm one thing, how many names in your txt file?
If there is multi persons' information, this demand will be very complex.

Best regards!
Pedro


Only Paranoid Survive.

Offline

#3 2011-12-06 16:10:16

oscarmsanz
Member
Registered: 1970-01-01
Posts: 78

Re: Loading a txt file without loading certain lines in a table oracle

Hi Pedro

You guessed with what I have to do.

First you answer your question.

I'm going to get any number of files of this type to a particular directory. Each file shall bear the information of one person. That is, each file will load a single row or record of my table orcle as you had indicated.

You through an example of a file I have, but first you put the paragraphs that do not have to carry are:

CE-SEF-2010
DECLARACION RESPONSABLE DE CUENTAS ANUALES
DATOS A CIERRE DEL EJERCICIO SOCIAL

A los efectos del cumplimiento de los requisitos establecidos para el mantenimiento de
la clasificación empresarial por el artículo 59.2 de la Ley 30/2007, de 30 de octubre,
de Contratos del Sector Público, y por el artículo 2 del Real Decreto 817/2009, de 8 de mayo,
de desarrollo parcial de la misma, DECLARO ser ciertos los datos aquí señalados y me
comprometo a poner a disposición de la Subdirección General de Clasificación de Contratistas
los documentos que lo acreditan, si así me es requerido.

------------------------------------------------------------------------------------------------------------------------------

The entire file is loaded as an example:




CE-SEF-2010
DECLARACION RESPONSABLE DE CUENTAS ANUALES
DATOS A CIERRE DEL EJERCICIO SOCIAL




EJERCICIO: 2010
NIF: A12345678
NOMBRE/DENOMINACION SOCIAL: ACME, S.A.
SIGNO PATRIMONIO NETO: POSITIVO
SIGNO RESULTADO DEL EJERCICIO: NEGATIVO
INSCRITA EN EL REGISTRO: MERCANTIL DE MADRID
FECHA DE CIERRE DEL EJERCICIO SOCIAL: 2010-12-31
FECHA DE APROBACION DE CUENTAS: 2011-02-20
FECHA DE PRESENTACION DE CUENTAS EN REGISTRO: 2011-06-18
CAPITAL SOCIAL A CIERRE DE EJERCICIO: 300.000,00 euros
PATRIMONIO NETO A CIERRE DE EJERCICIO: 4.522.000,28 euros
RESULTADO DEL EJERCICIO: -1.000,02 euros
TOTAL ACTIVO A CIERRE DE EJERCICIO: 6.125.000,87 euros
INFORME DE AUDITORIA: SI
NOMBRE DEL AUDITOR: ERNESTO RUIZ ESPAÑOL
CUENTAS FORMULADAS EN MODELO: PYMES



A los efectos del cumplimiento de los requisitos establecidos para el mantenimiento de
la clasificación empresarial por el artículo 59.2 de la Ley 30/2007, de 30 de octubre,
de Contratos del Sector Público, y por el artículo 2 del Real Decreto 817/2009, de 8 de mayo,
de desarrollo parcial de la misma, DECLARO ser ciertos los datos aquí señalados y me
comprometo a poner a disposición de la Subdirección General de Clasificación de Contratistas
los documentos que lo acreditan, si así me es requerido.



NOMBRE DEL DECLARANTE: PEDRO
APELLIDOS DEL DECLARANTE: LOPEZ LOPI
NIF/NIE DEL DECLARANTE: 12345678P
CARGO DEL DECLARANTE: ADMINISTRADOR
FECHA DE NOMBRAMIENTO EN EL CARGO: 2008-03-05



Best regards!
Oscar Manso Sanz

Last edited by oscarmsanz (2011-12-06 16:21:03)

Offline

#4 2011-12-07 10:44:10

pedro
Member
Registered: 2011-11-17
Posts: 3682

Re: Loading a txt file without loading certain lines in a table oracle

Hi
I create a job to meet your demand which i can't ensure perfect performance.
I use tMap to extract each attribute (DNI, name, age, country, province).
And you can do this by using textractRegexFields and textractDelimitedFields instead.
You may get more information as follows.

If you have many txt files, you can use tFileList to load each file.

Best regards!
Pedro


Uploaded Images

Last edited by pedro (2011-12-07 10:48:13)


Only Paranoid Survive.

Offline

#5 2011-12-07 14:44:16

nicolasdiogo
Member
Company: BrainPowered - BI Services UK
Registered: 2006-11-24
Posts: 380
Website

Re: Loading a txt file without loading certain lines in a table oracle

sorry

but if you know what you do not want and you have ANCHORS (of sorts)

you are interested in lines between:
:BEGIN anchor
A los efectos del cumplimiento ... que lo acreditan, si así me es requerido.


:END anchor
Best regards!

so if you can identify what is between these 2 anchors, you get:
NOMBRE DEL DECLARANTE: PEDRO
APELLIDOS DEL DECLARANTE: LOPEZ LOPI
NIF/NIE DEL DECLARANTE: 12345678P
CARGO DEL DECLARANTE: ADMINISTRADOR
FECHA DE NOMBRAMIENTO EN EL CARGO: 2008-03-05


if that is what you looking for.
you could model this other response to assist you.
http://www.talendforge.org/forum/viewtopic.php?id=19492

Offline

#6 2011-12-11 20:48:38

oscarmsanz
Member
Registered: 1970-01-01
Posts: 78

Re: Loading a txt file without loading certain lines in a table oracle

Hi Pedro

Thank you for your answer. It has helped me a lot

Regards,
Oscar Manso

Offline

#7 2011-12-12 21:38:44

slenk
Member
Registered: 2010-09-03
Posts: 70
Website

Re: Loading a txt file without loading certain lines in a table oracle

Hola oscarmsanz,

creo que algo como mostrado en las fotos seria una primer idea facil de hacer lo que tu quieres. Tendrias que solamente denormalizarlo segun la tabla donde deben guardarse los datos al final.

Espero que te ayude. Sobre todo eso no requiere mas código individual.


Uploaded Images

Last edited by slenk (2011-12-12 21:45:49)


Talend - simply great!!!

Offline

#8 2012-05-03 00:13:50

oscarmsanz
Member
Registered: 1970-01-01
Posts: 78

Re: Loading a txt file without loading certain lines in a table oracle

Hi

Ok, thanks.



Regards,
Oscar Manso

Offline

  • Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » Loading a txt file without loading certain lines in a table oracle

Board footer

Powered by FluxBB