def create_instance(self, cr, uid, id, context, data={}):
     trans = self.browse(cr, uid, id)
     trans_data = {}
     TRAN_MAP ={
             'string' : etl.transformer.STRING,
             'float' : etl.transformer.FLOAT,
             'long' : etl.transformer.LONG,
             'datetime' : etl.transformer.DATETIME,
             'complex' : etl.transformer.COMPLEX,
             'time' : etl.transformer.TIME,
             'date' : etl.transformer.DATE,
             'integer' : etl.transformer.INTEGER,
             'boolean' : etl.transformer.BOOLEAN,
                }
     for line in  trans.tranformer_line_ids:
         trans_data[line.name] = TRAN_MAP[line.type]
     val = etl.transformer(trans_data)
     return val
Exemplo n.º 2
0
 def create_instance(self, cr, uid, id, context, data={}):
     trans = self.browse(cr, uid, id)
     trans_data = {}
     TRAN_MAP = {
         'string': etl.transformer.STRING,
         'float': etl.transformer.FLOAT,
         'long': etl.transformer.LONG,
         'datetime': etl.transformer.DATETIME,
         'complex': etl.transformer.COMPLEX,
         'time': etl.transformer.TIME,
         'date': etl.transformer.DATE,
         'integer': etl.transformer.INTEGER,
         'boolean': etl.transformer.BOOLEAN,
     }
     for line in trans.tranformer_line_ids:
         trans_data[line.name] = TRAN_MAP[line.type]
     val = etl.transformer(trans_data)
     return val
Exemplo n.º 3
0
def test():
    from etl_test import etl_test
    from etl import transformer
    import etl
    openobject_partner=etl.connector.openobject_connector('http://localhost:8869', 'trunk', 'admin', 'admin',con_type='xmlrpc')
    transformer_description= {'title':transformer.STRING,'name':transformer.STRING,'street':transformer.STRING,'street2':transformer.STRING,'birthdate':transformer.DATE}
    transformer=transformer(transformer_description)
    openobject_in1= etl.component.input.openobject_in(
                 openobject_partner,'res.partner.address',
                 fields=['partner_id','title', 'name', 'street', 'street2' , 'phone' , 'city' ,  'zip' ,'state_id' , 'country_id' , 'mobile', 'birthdate'],
                 transformer=transformer)
    filter_criteria=[
        {'name':'Partner','filter':'"%(Partner)s".lower() or ""','operator':'==','operand':"'leclerc'",'condition':'or'},
        {'name':'Address Name','operator':'==','operand':"'Fabien Pinckaers'"}
        ]

    test1 = data_filter_component=etl_test.etl_component_test(etl.component.transform.data_filter(filter_criteria,transformer=transformer))
    res = test1.output()
    print res
Exemplo n.º 4
0
sys.path.append('..')

import etl
from etl import transformer

openobject_partner = etl.connector.openobject_connector(
    'http://localhost:8869', 'panimpex', 'phuong', 'phu', con_type='xmlrpc')

transformer_description = {
    'title': transformer.STRING,
    'name': transformer.STRING,
    'street': transformer.STRING,
    'street2': transformer.STRING,
    'birthdate': transformer.DATE
}
transformer = transformer(transformer_description)

openobject_in1 = etl.component.input.openobject_in(
    openobject_partner,
    'res.partner.address',
    fields=[
        'partner_id', 'title', 'name', 'street', 'street2', 'phone', 'city',
        'zip', 'state_id', 'country_id', 'mobile', 'birthdate'
    ],
    transformer=transformer)
map_criteria = [{
    'name': 'country_id',
    'map': "%(country_id)s and %(country_id)s[1].upper() or ''",
    'destination': 'Country Name'
}, {
    'name': 'state_id',
Exemplo n.º 5
0
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.     
#
##############################################################################
import sys
sys.path.append('..')

import etl
from etl import transformer

fileconnector_partner=etl.connector.localfile('input/partner.csv')
trans=transformer( { 
       'id':transformer.LONG,   
       'name':transformer.STRING,     
       'tel':transformer.STRING,
       })


csv_in1= etl.component.input.csv_in(fileconnector=fileconnector_partner,name='Partner Data',transformer=trans)


schema= {
         'id':{'type':'long','key':True,'Is_Null':True},
         'name':{'type':'unicode','size':'20','Is_NULL':False},
         'tel':{'type':'unicode','Is_NULL':False},
         
      }
schema_valid=etl.component.transform.schema_validator(schema)
log1=etl.component.transform.logger(name='invalid_field')
Exemplo n.º 6
0
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.     
#
##############################################################################
import sys
sys.path.append('..')

import etl
from etl import transformer

fileconnector=etl.connector.localfile('input/invoice.csv')
trans=transformer(
    {
        'id':transformer.LONG,
        'name':transformer.STRING,
        'invoice_date':transformer.DATE,
        'invoice_amount':transformer.FLOAT,
        'is_paid':transformer.BOOLEAN
    }
)
csv_in1= etl.component.input.csv_in(fileconnector=fileconnector,transformer=trans)
log1=etl.component.transform.logger(name='Read Invoice File')
tran=etl.transition(csv_in1,log1)
job1=etl.job([csv_in1,log1])
job1.run()
Exemplo n.º 7
0
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.     
#
##############################################################################
import sys
sys.path.append('..')

import etl
from etl import transformer

openobject_partner=etl.connector.openobject_connector('http://localhost:8869', 'panimpex', 'phuong', 'phu',con_type='xmlrpc')

transformer_description= {'title':transformer.STRING,'name':transformer.STRING,'street':transformer.STRING,'street2':transformer.STRING,'birthdate':transformer.DATE}    
transformer=transformer(transformer_description)

openobject_in1= etl.component.input.openobject_in(
                 openobject_partner,'res.partner.address',
                 fields=['partner_id','title', 'name', 'street', 'street2' , 'phone' , 'city' ,  'zip' ,'state_id' , 'country_id' , 'mobile', 'birthdate'],
                 transformer=transformer)
map_criteria=[
        {'name':'country_id','map':"%(country_id)s and %(country_id)s[1].upper() or ''",'destination':'Country Name'},
        {'name':'state_id','map':"%(state_id)s and %(state_id)s[1].upper() or ''",'destination':'State Name'},
        {'name':'partner_id','map':"%(partner_id)s and %(partner_id)s[1] or ''",'destination':'Partner'},
        {'name':"name",'destination':'Address Name'}
        ]

data_map_component=etl.component.transform.map(map_criteria,transformer=transformer)

filter_criteria=[
Exemplo n.º 8
0
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import sys
sys.path.append('..')

import etl
from etl import transformer

fileconnector_partner = etl.connector.localfile('input/partner.csv')
trans = transformer({
    'id': transformer.LONG,
    'name': transformer.STRING,
    'tel': transformer.STRING,
})

csv_in1 = etl.component.input.csv_in(fileconnector=fileconnector_partner,
                                     name='Partner Data',
                                     transformer=trans)

schema = {
    'id': {
        'type': 'long',
        'key': True,
        'Is_Null': True
    },
    'name': {
        'type': 'unicode',