[IMP]: olap: code optimization and apply csv file and doc string

bzr revid: ksa@tinyerp.co.in-20100317134106-p2f47zevn98vnxhi
This commit is contained in:
ksa (Open ERP)
2010-03-17 19:11:06 +05:30
parent 2fc14fc77d
commit e8c8414c8b
9 changed files with 1063 additions and 652 deletions
+13 -20
View File
@@ -1,28 +1,21 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
# Fabien Pinckaers <fp@tiny.Be>
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# 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.
#
# 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# 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/>.
#
##############################################################################
+23 -1
View File
@@ -1,3 +1,24 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# 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/>.
#
##############################################################################
{
"name" : "Olap Schemes Management",
"version" : "0.1",
@@ -17,7 +38,8 @@
"data/olap_cube_view.xml",
"data/olap_fact_view.xml",
"data/olap_cube_workflow.xml",
"data/olap_security.xml"
"data/olap_security.xml",
'security/ir.model.access.csv'
],
"demo_xml" : ["data/olap_demo.xml"],
"active": False,
+878 -464
View File
File diff suppressed because it is too large Load Diff
+13 -19
View File
@@ -1,27 +1,21 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# 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.
#
# 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# 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/>.
#
##############################################################################
+21 -29
View File
@@ -1,27 +1,21 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# 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.
#
# 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# 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/>.
#
##############################################################################
@@ -32,6 +26,7 @@ class olap_load_column(osv.osv_memory):
_description = "Olap Load Column"
def get_table_data(self, cr, uid, ids, context={}):
"""
This function load column
@param cr: the current row, from the database cursor,
@@ -41,13 +36,13 @@ class olap_load_column(osv.osv_memory):
"""
data = context and context.get('active_id', False) or False
ids_cols = self.pool.get('olap.database.columns').search(cr, uid,\
([('table_id','=',data)]),context={})
model_data_ids = self.pool.get('ir.model.data').search(cr,uid,\
[('model','=','ir.ui.view'),\
('name','=','view_olap_database_columns_form')],context={})
resource_id = self.pool.get('ir.model.data').read(cr,uid,\
model_data_ids,fields=['res_id'])[0]['res_id']
ids_cols = self.pool.get('olap.database.columns').search(cr, uid, \
([('table_id', '=', data)]), context={})
model_data_ids = self.pool.get('ir.model.data').search(cr, uid, \
[('model', '=', 'ir.ui.view'), \
('name', '=', 'view_olap_database_columns_form')], context={})
resource_id = self.pool.get('ir.model.data').read(cr, uid, \
model_data_ids, fields=['res_id'])[0]['res_id']
return {
'domain': "[('id','in', ["+','.join(map(str,ids_cols))+"])]",
'name': 'Database Columns',
@@ -57,9 +52,6 @@ class olap_load_column(osv.osv_memory):
'views': [(False,'tree'),(resource_id,'form')],
'type': 'ir.actions.act_window',
}
_columns = {
}
olap_load_column()
+5 -1
View File
@@ -2,7 +2,7 @@
<openerp>
<data>
<!-- Open Column -->
<!-- Open Column From View -->
<record id="view_olap_load_column" model="ir.ui.view">
<field name="name">Open Columns</field>
@@ -16,6 +16,8 @@
</field>
</record>
<!-- Open Column Action -->
<record id="action_olap_load_column" model="ir.actions.act_window">
<field name="name">Open Columns</field>
<field name="type">ir.actions.act_window</field>
@@ -26,6 +28,8 @@
<field name="target">new</field>
</record>
<!-- Open Column Action Window -->
<act_window id="action_olap_load_column_values"
key2="client_action_multi" name="Open Columns"
res_model="olap.load.column" src_model="olap.database.columns"
+16 -23
View File
@@ -1,27 +1,21 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# 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.
#
# 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# 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/>.
#
##############################################################################
@@ -30,6 +24,7 @@ from osv import fields, osv
class olap_query_logs_clear(osv.osv_memory):
_name = "olap.query.logs.clear"
_description = "Olap Query Logs Clear"
_columns = {
'user_name':fields.char('User',size=64,required=True,readonly=True),
}
@@ -50,8 +45,8 @@ class olap_query_logs_clear(osv.osv_memory):
@param ids: List of load column,
@return: dictionary of query logs clear message window
"""
ids = self.pool.get('olap.query.logs').search(cr,uid,[('user_id','=',uid)])
self.pool.get('olap.query.logs').unlink(cr, uid,ids,context)
ids = self.pool.get('olap.query.logs').search(cr, uid, [('user_id', '=', uid)])
self.pool.get('olap.query.logs').unlink(cr, uid, ids, context)
data_obj = self.pool.get('ir.model.data')
id2 = data_obj._get_id(cr, uid, 'olap', 'view_olap_query_logs_clear_msg')
if id2:
@@ -73,9 +68,7 @@ class olap_query_logs_clear_msg(osv.osv_memory):
""" Display clear log message """
_name = "olap.query.logs.clear.msg"
_description = "Olap Query Logs Clear Message"
_columns = {
}
olap_query_logs_clear_msg()
# vim: ts=4 sts=4 sw=4 si et
@@ -2,7 +2,7 @@
<openerp>
<data>
<!-- Create Logs -->
<!-- Create Logs Form View -->
<record id="view_olap_query_logs_clear" model="ir.ui.view">
<field name="name">Clear Logs</field>
@@ -21,6 +21,8 @@
</field>
</record>
<!-- Create Logs Action -->
<record id="action_view_olap_query_logs_clear" model="ir.actions.act_window">
<field name="name">Clear Logs </field>
<field name="type">ir.actions.act_window</field>
@@ -30,6 +32,8 @@
<field name="target">new</field>
</record>
<!-- Clear Logs Form View -->
<record id="view_olap_query_logs_clear_msg" model="ir.ui.view">
<field name="name">Clear Logs Message</field>
<field name="model">olap.query.logs.clear.msg</field>
+89 -94
View File
@@ -1,29 +1,24 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# 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.
#
# 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# 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 psycopg2
import time
@@ -41,11 +36,11 @@ form1 = '''<?xml version="1.0"?>
<form string="Load Database Structure">
<label align="0.0" string="We will load the complete structure of the database by introspection,
so that you will be able to work on it, and specify a better structure
so that you will be able to work on it, and specify a better structure
according to your reporting needs." colspan="4" />
<newline/>
<label align="0.0" string="After having loaded the structure, you will be able to hide/show or
rename tables and columns to simplify end-users interface. The following database
<label align="0.0" string="After having loaded the structure, you will be able to hide/show or
rename tables and columns to simplify end-users interface. The following database
will be loaded:" colspan="4"/>
<field align="0.0" name='fact_table'/>
<newline/>
@@ -81,37 +76,37 @@ def olap_db_connect(self,cr,uid,part,context={}):
cr.execute('select column_db_name,id,table_id from olap_database_columns where table_id in (' + ','.join(tables_id) +')')
else:
cr.execute('select column_db_name,id,table_id from olap_database_columns')
for data in cr.fetchall():
cols[str(data[1])]=(data[0],int(data[2]))
print 'Creating / Updating Tables...'
print 'Creating / Updating Tables...'
cr_db.execute("select table_name, table_catalog from INFORMATION_SCHEMA.tables as a where a.table_schema = 'public'")
for table in cr_db.fetchall():
val = {
'fact_database_id':id_db,
'table_db_name':table[0]
}
if table[0] in tables.keys():
table_id=tobj.write(cr,uid,[tables[table[0]]], val, context)
else:
val['name']=table[0]
tables[val['name']] = tobj.create(cr,uid,val, context)
print 'Creating / Updating Columns...'
tables[val['name']] = tobj.create(cr,uid,val, context)
print 'Creating / Updating Columns...'
cr_db.execute("""SELECT
table_name, column_name, udt_name
from
INFORMATION_SCHEMA.columns
WHERE table_schema = 'public'""")
for col in cr_db.fetchall():
val={
'table_id': tables[col[0]],
'column_db_name': col[1],
'type': col[2],
}
id_made=filter(lambda x:(int(cols[x][1])==int(tables[col[0]])),cols)
if col[1] in cols.keys() and col[0] in tables.keys()and id_made:
col_id=tcol.write(cr,uid,cols[tables[str(col[0])]], val, context)
@@ -119,54 +114,54 @@ def olap_db_connect(self,cr,uid,part,context={}):
val['name']=col[1]
id_made = tcol.create(cr,uid,val, context)
cols[str(id_made)] = (val['name'],int(val['table_id']))
print 'Creating / Updating Constraints...'
cr_db.execute("""select
table_name,column_name
from
print 'Creating / Updating Constraints...'
cr_db.execute("""select
table_name,column_name
from
INFORMATION_schema.key_column_usage
where
where
constraint_name in (
select constraint_name from INFORMATION_SCHEMA .table_constraints
where
where
constraint_type = 'PRIMARY KEY')""")
print "Updating the Primary Key Constraint"
print "Updating the Primary Key Constraint"
for constraint in cr_db.fetchall():
val={
'primary_key':True
}
id_to_write=filter(lambda x:(int(cols[x][1])==int(tables[constraint[0]])and(constraint[1]==cols[x][0])),cols)
col_id=tcol.write(cr,uid,int(id_to_write[0]),val,context)
print "Updating the Foreign key constraint"
cr_db.execute("""select
constraint_name,table_name
from
INFORMATION_schema.constraint_column_usage
col_id=tcol.write(cr,uid,int(id_to_write[0]),val,context)
print "Updating the Foreign key constraint"
cr_db.execute("""select
constraint_name,table_name
from
INFORMATION_schema.constraint_column_usage
where
constraint_name in (
select constraint_name from INFORMATION_SCHEMA.table_constraints
where
select constraint_name from INFORMATION_SCHEMA.table_constraints
where
constraint_type = 'FOREIGN KEY')""")
for_key=dict(cr_db.fetchall())
cr_db.execute("""select
table_name,column_name,constraint_name
from
cr_db.execute("""select
table_name,column_name,constraint_name
from
INFORMATION_schema.key_column_usage
where
where
constraint_name in (
select constraint_name from INFORMATION_SCHEMA.table_constraints
where
constraint_type = 'FOREIGN KEY')""")
select constraint_name from INFORMATION_SCHEMA.table_constraints
where
constraint_type = 'FOREIGN KEY')""")
for constraint in cr_db.fetchall():
val={
'related_to':tables[for_key[constraint[2]]]
}
id_to_write=filter(lambda x:(int(cols[x][1])==int(tables[constraint[0]])and (constraint[1]==cols[x][0])),cols)
col_id=tcol.write(cr,uid,int(id_to_write[0]),val,context)
col_id=tcol.write(cr,uid,int(id_to_write[0]),val,context)
elif type =='mysql':
try:
import MySQLdb
@@ -176,10 +171,10 @@ def olap_db_connect(self,cr,uid,part,context={}):
user = lines.database_id.db_login or ''
passwd = lines.database_id.db_password or ''
tdb = MySQLdb.connect(host = host,port = port, db = db, user = user, passwd = passwd)
except Exception, e:
raise osv.except_osv('MySQLdb Packages Not Installed.',e )
cr_db = tdb.cursor()
cr.execute('select table_db_name,id from olap_database_tables where fact_database_id=%d', (id_db,))
tables = dict(cr.fetchall())
@@ -189,20 +184,20 @@ def olap_db_connect(self,cr,uid,part,context={}):
cr.execute('select column_db_name,id,table_id from olap_database_columns where table_id in (' + ','.join(tables_id) +')')
else:
cr.execute('select column_db_name,id,table_id from olap_database_columns')
for data in cr.fetchall():
cols[str(data[1])]=(data[0],int(data[2]))
cr_db.execute("select table_name, table_catalog from INFORMATION_SCHEMA.tables where table_schema =%s",(db_name))
for table in cr_db.fetchall():
val = {
'fact_database_id':id_db,
'table_db_name':table[0]
}
if table[0] in tables.keys():
table_id=tobj.write(cr,uid,[tables[table[0]]], val, context)
else:
val['name']=table[0]
tables[val['name']] = tobj.create(cr,uid,val, context)
@@ -211,15 +206,15 @@ def olap_db_connect(self,cr,uid,part,context={}):
from
INFORMATION_SCHEMA.columns
WHERE table_schema = %s""",(db_name))
for col in cr_db.fetchall():
val={
'table_id': tables[col[0]],
'column_db_name': col[1],
'type': col[2],
}
id_made=filter(lambda x:(int(cols[x][1])==int(tables[col[0]])),cols)
if col[1] in cols.keys() and col[0] in tables.keys()and id_made:
col_id=tcol.write(cr,uid,cols[tables[str(col[0])]], val, context)
@@ -227,32 +222,32 @@ def olap_db_connect(self,cr,uid,part,context={}):
val['name']=col[1]
id_made = tcol.create(cr,uid,val, context)
cols[str(id_made)] = (val['name'],int(val['table_id']))
cr_db.execute("""select
cr_db.execute("""select
REFERENCED_COLUMN_NAME,REFERENCED_TABLE_NAME,COLUMN_NAME,TABLE_NAME
from
from
INFORMATION_schema.key_column_usage
where table_schema= %s and
where table_schema= %s and
constraint_name in (
select constraint_name from INFORMATION_SCHEMA .table_constraints
where
where
constraint_type in('PRIMARY KEY','FOREIGN KEY'))
""",(db_name))
""",(db_name))
for constraint in cr_db.fetchall():
if constraint[0]:
val={
'related_to':tables[constraint[1]]
}
else:
val={
'primary_key':True
}
id_to_write=filter(lambda x:(int(cols[x][1])==int(tables[constraint[3]])and(constraint[2]==cols[x][0])),cols)
col_id=tcol.write(cr,uid,int(id_to_write[0]),val,context)
col_id=tcol.write(cr,uid,int(id_to_write[0]),val,context)
elif type == 'oracle':
try:
import cx_Oracle
@@ -262,7 +257,7 @@ def olap_db_connect(self,cr,uid,part,context={}):
user = lines.database_id.db_login.upper() or ''
passwd = lines.database_id.db_password or ''
tdb = cx_Oracle.connect(user, passwrd, host)
except Exception, e:
raise osv.except_osv('cx_Oracle Packages Not Installed.',e )
@@ -275,7 +270,7 @@ def olap_db_connect(self,cr,uid,part,context={}):
cr.execute('select column_db_name,id,table_id from olap_database_columns where table_id in (' + ','.join(tables_id) +')')
else:
cr.execute('select column_db_name,id,table_id from olap_database_columns')
for data in cr.fetchall():
cols[str(data[1])]=(data[0],int(data[2]))
@@ -286,10 +281,10 @@ def olap_db_connect(self,cr,uid,part,context={}):
'fact_database_id':id_db,
'table_db_name':table[0]
}
if table[0] in tables.keys():
table_id=tobj.write(cr,uid,[tables[table[0]]], val, context)
else:
val['name']=table[0]
tables[val['name']] = tobj.create(cr,uid,val, context)
@@ -297,7 +292,7 @@ def olap_db_connect(self,cr,uid,part,context={}):
cr_db.execute("""SELECT
table_name, column_name, data_type
from
all_tab_columns
all_tab_columns
WHERE owner = %s""",(user))
temp = cr_db.fetchall()
for col in temp:
@@ -314,7 +309,7 @@ def olap_db_connect(self,cr,uid,part,context={}):
'column_db_name': col[1],
'type': type_col,
}
id_made=filter(lambda x:(int(cols[x][1])==int(tables[col[0]])),cols)
if col[1] in cols.keys() and col[0] in tables.keys()and id_made:
col_id=tcol.write(cr,uid,cols[tables[str(col[0])]], val, context)
@@ -323,18 +318,18 @@ def olap_db_connect(self,cr,uid,part,context={}):
id_made = tcol.create(cr,uid,val, context)
cols[str(id_made)] = (val['name'],int(val['table_id']))
cr_db.execute("""select
cr_db.execute("""select
table_name,column_name,constraint_name
from
from
all_cons_columns
where
constraint_name in (
select constraint_name from all_constraints
where
where
constraint_type = 'P' and owner= %s)
""",(user))
""",(user))
temp = cr_db.fetchall()
pk_table = {}
pk_table = {}
for constraint in temp:
val={
'primary_key' : True
@@ -344,26 +339,26 @@ def olap_db_connect(self,cr,uid,part,context={}):
id_to_write=filter(lambda x : (int(cols[x][1])==int(tables[constraint[0]])and(constraint[1]==cols[x][0])),cols)
col_id=tcol.write(cr,uid,int(id_to_write[0]),val,context)
cr_db.execute("""select
cr_db.execute("""select
constraint_name,r_constraint_name from all_constraints
where
where
constraint_type = 'R' and owner = %s
""",(user))
constraints_map={}
for data in cr_db.fetchall():
constraints_map[data[0]]=data[1]
cr_db.execute("""select
cr_db.execute("""select
table_name,column_name,constraint_name
from
from
all_cons_columns
where
constraint_name in (
select constraint_name from all_constraints
where
where
constraint_type = 'R' and owner = %s)
""",(user))
temp = cr_db.fetchall()
for constraint in temp:
@@ -374,7 +369,7 @@ def olap_db_connect(self,cr,uid,part,context={}):
}
id_to_write=filter(lambda x:(int(cols[x][1])==int(tables[constraint[0]])and (constraint[1]==cols[x][0])),cols)
col_id=tcol.write(cr,uid,int(id_to_write[0]),val,context)
pooler.get_pool(cr.dbname).get('olap.fact.database').write(cr,uid,[id_db],{'loaded':True})
wf_service = netsvc.LocalService('workflow')
wf_service.trg_validate(uid, 'olap.schema', part['id'], 'dbload', cr)