Alembic: AttributeError: 'RedshiftDDLCompiler' object has no attribute 'visit clause' - python

I have this issue when I try to run upgrade on a migration that will change the type of a VARCHAR column to INTEGER and change the PK too. This is traceback:
The definition of the class is the follow:
class ActionsIntiza(Base):
__tablename__ = 'actions_intiza'
customer_user_id = sa.Column(sa.VARCHAR(20), nullable=False)
customer_id = sa.Column(sa.INTEGER(), primary_key=True, info={'sortkey': True})
intiza_action_created = sa.Column(sa.DATE(), nullable=False)
intiza_action = sa.Column(sa.VARCHAR(50), nullable=False)
intiza_action_type = sa.Column(sa.VARCHAR(50))
intiza_action_tag = sa.Column(sa.VARCHAR(50))
intiza_action_comment = sa.Column(sa.VARCHAR())
intiza_action_attachment = sa.Column(sa.VARCHAR(50))
moni_user_name = sa.Column(sa.VARCHAR(50))
The traceback:
Traceback (most recent call last):
File "C:\Users\Usuario\AppData\Roaming\Python\Python38\site-packages\sqlalchemy\sql\visitors.py", line 88, in _compiler_dispatch
meth = getter(visitor)
AttributeError: 'RedshiftDDLCompiler' object has no attribute 'visit_clause'
op.alter_column('actions_intiza', 'customer_id',
File "<string>", line 8, in alter_column
File "<string>", line 3, in alter_column
File "c:\users\usuario\appdata\local\programs\python\python38\lib\site-packages\alembic\operations\ops.py", line 1777, in alter_column
return operations.invoke(alt)
File "c:\users\usuario\appdata\local\programs\python\python38\lib\site-packages\alembic\operations\base.py", line 345, in invoke
return fn(self, operation)
File "c:\users\usuario\appdata\local\programs\python\python38\lib\site-packages\alembic\operations\toimpl.py", line 43, in alter_column
operations.impl.alter_column(
File "c:\users\usuario\appdata\local\programs\python\python38\lib\site-packages\alembic\ddl\postgresql.py", line 116, in alter_column
self._exec(
File "c:\users\usuario\appdata\local\programs\python\python38\lib\site-packages\alembic\ddl\impl.py", line 134, in _exec
return conn.execute(construct, *multiparams, **params)
File "C:\Users\Usuario\AppData\Roaming\Python\Python38\site-packages\sqlalchemy\engine\base.py", line 982, in execute
return meth(self, multiparams, params)
File "C:\Users\Usuario\AppData\Roaming\Python\Python38\site-packages\sqlalchemy\sql\ddl.py", line 72, in _execute_on_connection
return connection._execute_ddl(self, multiparams, params)
File "C:\Users\Usuario\AppData\Roaming\Python\Python38\site-packages\sqlalchemy\engine\base.py", line 1033, in _execute_ddl
compiled = ddl.compile(
File "<string>", line 1, in <lambda>
File "C:\Users\Usuario\AppData\Roaming\Python\Python38\site-packages\sqlalchemy\sql\elements.py", line 468, in compile
return self._compiler(dialect, bind=bind, **kw)
File "C:\Users\Usuario\AppData\Roaming\Python\Python38\site-packages\sqlalchemy\sql\ddl.py", line 29, in _compiler
return dialect.ddl_compiler(dialect, self, **kw)
File "C:\Users\Usuario\AppData\Roaming\Python\Python38\site-packages\sqlalchemy\sql\compiler.py", line 319, in __init__
self.string = self.process(self.statement, **compile_kwargs)
File "C:\Users\Usuario\AppData\Roaming\Python\Python38\site-packages\sqlalchemy\sql\compiler.py", line 350, in process
return obj._compiler_dispatch(self, **kwargs)
File "C:\Users\Usuario\AppData\Roaming\Python\Python38\site-packages\sqlalchemy\ext\compiler.py", line 436, in <lambda>
lambda *arg, **kw: existing(*arg, **kw),
File "C:\Users\Usuario\AppData\Roaming\Python\Python38\site-packages\sqlalchemy\ext\compiler.py", line 478, in __call__
return fn(element, compiler, **kw)
File "C:\Users\Usuario\AppData\Roaming\Python\Python38\site-packages\sqlalchemy\ext\compiler.py", line 425, in _wrap_existing_dispatch
raise exc.CompileError(
sqlalchemy.exc.CompileError: <class 'alembic.ddl.postgresql.PostgresqlColumnType'> construct has no default compilation handler.
Can you help me?

Related

TypeError: 'bool' object is not subscriptable in Python3,odoo

I don't know where my problem is. Because years is char field must be string not bool.
I feel really frustrated. What can I do to fix this problem?
Any sort of help will be much appreciated!
Please give me some suggestions. Thanks!
Here is my code:
class HreDetailList(models.EcoModel):
_name = "hre.detail.list"
def _compute_holiday_flag(self):
for record in self:
record.work_on_holiday = False
now_year = int(record.years[:4])
next_year = now_year + 1
holiday_obj = self.env['hra.holiday']
holiday_data = holiday_obj.search([('holi_yy', 'ilike', next_year),
('holi_name', '=', 'Xmas')])
change_obj = self.env['hre.changedtl']
change_data = change_obj.search([('hre_empbas_id.emp_no', '=', record.emp_no),
('trans_flag', '=', True),
('lt_startdate', '=like', record.years[:4] + '%')])
for change_datadtl in change_data:
if change_datadtl.chg_kind == '6M' or change_datadtl.chg_kind == '6N' or change_datadtl.chg_kind == '6L':
if holiday_data.holi_date >= change_datadtl.lt_startdate and holiday_data.holi_date <= change_datadtl.lt_enddate:
record.work_on_holiday = True
break
else:
record.work_on_holiday = False
years = fields.Char(string='Year', size=7, required=True)
work_on_holiday = fields.Boolean(compute=_compute_holiday_flag, string='Work on holiday')
I am getting following error: TypeError: 'bool' object is not subscriptable:
Odoo Server Error
Traceback (most recent call last):
File "/vagrant/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/vagrant/odoo/odoo/http.py", line 682, in dispatch
result = self._call_function(**self.params)
File "/vagrant/odoo/odoo/http.py", line 358, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/vagrant/odoo/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/vagrant/odoo/odoo/http.py", line 346, in checked_call
result = self.endpoint(*a, **kw)
File "/vagrant/odoo/odoo/http.py", line 911, in __call__
return self.method(*args, **kw)
File "/vagrant/odoo/odoo/http.py", line 530, in response_wrap
response = f(*args, **kw)
File "/vagrant/odoo/addons/web/controllers/main.py", line 1359, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/vagrant/odoo/addons/web/controllers/main.py", line 1351, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/vagrant/odoo/odoo/api.py", line 396, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/vagrant/odoo/odoo/api.py", line 383, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "/vagrant/odoo/odoo/models.py", line 6165, in onchange
value = record[name]
File "/vagrant/odoo/odoo/models.py", line 5640, in __getitem__
return self._fields[key].__get__(self, type(self))
File "/vagrant/odoo/odoo/fields.py", line 972, in __get__
self.compute_value(recs)
File "/vagrant/odoo/odoo/fields.py", line 1111, in compute_value
records._compute_field_value(self)
File "/vagrant/odoo/odoo/models.py", line 4037, in _compute_field_value
field.compute(self)
File "/vagrant/odoo/addons/hre_formwork/models/hre_formwork.py", line 3887, in_compute_holiday_flag
now_year = int(record.years[:4])
Exception
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/vagrant/odoo/odoo/http.py", line 638, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/vagrant/odoo/odoo/http.py", line 314, in _handle_exception
raise exception.with_traceback(None) from new_cause
TypeError: 'bool' object is not subscriptable

How to fix model error when upgrading module in odoo 13

I get this error when I try to upgrade my custom module in odoo 13.
Odoo Server Error
Traceback (most recent call last):
File "/odoo/odoo-server/odoo/http.py", line 619, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/odoo/odoo-server/odoo/http.py", line 309, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/odoo/odoo-server/odoo/tools/pycompat.py", line 14, in reraise
raise value
File "/odoo/odoo-server/odoo/http.py", line 664, in dispatch
result = self._call_function(**self.params)
File "/odoo/odoo-server/odoo/http.py", line 345, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/odoo/odoo-server/odoo/service/model.py", line 93, in wrapper
return f(dbname, *args, **kwargs)
File "/odoo/odoo-server/odoo/http.py", line 338, in checked_call
result = self.endpoint(*a, **kw)
File "/odoo/odoo-server/odoo/http.py", line 910, in __call__
return self.method(*args, **kw)
File "/odoo/odoo-server/odoo/http.py", line 510, in response_wrap
response = f(*args, **kw)
File "/odoo/odoo-server/addons/web/controllers/main.py", line 1324, in call_button
action = self._call_kw(model, method, args, kwargs)
File "/odoo/odoo-server/addons/web/controllers/main.py", line 1312, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/odoo/odoo-server/odoo/api.py", line 387, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/odoo/odoo-server/odoo/api.py", line 374, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "<decorator-gen-64>", line 2, in button_immediate_upgrade
File "/odoo/odoo-server/odoo/addons/base/models/ir_module.py", line 72, in check_and_log
return method(self, *args, **kwargs)
File "/odoo/odoo-server/odoo/addons/base/models/ir_module.py", line 629, in button_immediate_upgrade
return self._button_immediate_function(type(self).button_upgrade)
File "/odoo/odoo-server/odoo/addons/base/models/ir_module.py", line 573, in _button_immediate_function
modules.registry.Registry.new(self._cr.dbname, update_module=True)
File "/odoo/odoo-server/odoo/modules/registry.py", line 86, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "/odoo/odoo-server/odoo/modules/loading.py", line 471, in load_modules
env['ir.model.data']._process_end(processed_modules)
File "/odoo/odoo-server/odoo/addons/base/models/ir_model.py", line 1971, in _process_end
record.unlink()
File "/odoo/odoo-server/odoo/addons/base/models/ir_model.py", line 1190, in unlink
table=self.env[selection.field_id.model]._table,
File "/opt/odoo/odoo13/odoo/api.py", line 463, in __getitem__
return self.registry[model_name]._browse(self, (), ())
File "/opt/odoo/odoo13/odoo/modules/registry.py", line 177, in __getitem__
return self.models[model_name]
KeyError: 'sales.terms'
This is the sales.terms model
class SalesTermsAndConditions(models.Model):
_name = 'sales.terms'
_description = 'Terms and Conditions'
_rec_name = 'typex'
new_type = fields.Selection([
('accessories', 'Accessories'),
('glass', 'Glass Work'),
('aluminium', 'Aluminium profiles'),
('projects', 'Projects')
], string='Testing')
d_active = fields.Boolean(string='Active')
notes = fields.Text()
I have a new model named 'sales.terms' I created and I created the corresponding ir.model.access.csv file for it, so I traced down the error and discovered that it isn't the whole model giving causing the error but just the selection field, if i remove the selection field the module upgrades fine.
I am confused as to what might be wrong.
I think there is something missing
class SalesTermsAndConditions(models.Model):
_name = 'sales.terms'
_description = 'Terms and Conditions'
_rec_name = 'typex'
new_type = fields.Selection([
('test', 'Test'),
('atest', 'A test'), // Comma is missing
('accessories', 'Accessories'),
('glass', 'Glass Work'),
('aluminium', 'Aluminium profiles'),
('projects', 'Projects')
], string='Testing')
d_active = fields.Boolean(string='Active')
notes = fields.Text()
Try to remove _rec_name.Replace with some field.
_rec_name = "new_type"
The selection seem to be ok. if you rename new_type does it then upgrade?
Can you look first errors wen you boot odoo or reload modules

Can't set uuid primary field in postgresql table flask-sqlalchemy

I am creating a backend with multiple tables have user id as the primary field with is of UUID type in the postgresql database. But I am getting the following error:
Traceback (most recent call last):
File "/home/ayushs/.local/share/virtualenvs/Server-D_x4HQZH/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1179, in _execute_context
context = constructor(dialect, self, conn, *args)
File "/home/ayushs/.local/share/virtualenvs/Server-D_x4HQZH/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 743, in _init_compiled
for key in compiled_params
File "/home/ayushs/.local/share/virtualenvs/Server-D_x4HQZH/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 743, in <genexpr>
for key in compiled_params
File "/home/ayushs/.local/share/virtualenvs/Server-D_x4HQZH/lib/python3.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.py", line 487, in process
value = _python_UUID(value)
File "/usr/lib64/python3.7/uuid.py", line 157, in __init__
hex = hex.replace('urn:', '').replace('uuid:', '')
AttributeError: 'UUID' object has no attribute 'replace'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/ayushs/.local/share/virtualenvs/Server-D_x4HQZH/lib/python3.7/site-packages/flask/app.py", line 1832, in full_dispatch_request
rv = self.dispatch_request()
File "/home/ayushs/.local/share/virtualenvs/Server-D_x4HQZH/lib/python3.7/site-packages/flask/app.py", line 1818, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/ayushs/.local/share/virtualenvs/Server-D_x4HQZH/lib/python3.7/site-packages/flask_restful/__init__.py", line 458, in wrapper
resp = resource(*args, **kwargs)
File "/home/ayushs/.local/share/virtualenvs/Server-D_x4HQZH/lib/python3.7/site-packages/flask/views.py", line 88, in view
return self.dispatch_request(*args, **kwargs)
File "/home/ayushs/.local/share/virtualenvs/Server-D_x4HQZH/lib/python3.7/site-packages/flask_restful/__init__.py", line 573, in dispatch_request
resp = meth(*args, **kwargs)
File "/mnt/home/Programming/Projects/Social Network/Server/src/new_user.py", line 17, in post
self.database_helper(args)
File "/mnt/home/Programming/Projects/Social Network/Server/src/new_user.py", line 26, in database_helper
db.session.commit()
File "/home/ayushs/.local/share/virtualenvs/Server-D_x4HQZH/lib/python3.7/site-packages/sqlalchemy/orm/scoping.py", line 162, in do
return getattr(self.registry(), name)(*args, **kwargs)
File "/home/ayushs/.local/share/virtualenvs/Server-D_x4HQZH/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 1026, in commit
self.transaction.commit()
File "/home/ayushs/.local/share/virtualenvs/Server-D_x4HQZH/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 493, in commit
self._prepare_impl()
File "/home/ayushs/.local/share/virtualenvs/Server-D_x4HQZH/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 472, in _prepare_impl
self.session.flush()
File "/home/ayushs/.local/share/virtualenvs/Server-D_x4HQZH/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 2458, in flush
self._flush(objects)
File "/home/ayushs/.local/share/virtualenvs/Server-D_x4HQZH/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 2596, in _flush
transaction.rollback(_capture_exception=True)
File "/home/ayushs/.local/share/virtualenvs/Server-D_x4HQZH/lib/python3.7/site-packages/sqlalchemy/util/langhelpers.py", line 68, in __exit__
compat.reraise(exc_type, exc_value, exc_tb)
File "/home/ayushs/.local/share/virtualenvs/Server-D_x4HQZH/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 129, in reraise
raise value
File "/home/ayushs/.local/share/virtualenvs/Server-D_x4HQZH/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 2556, in _flush
flush_context.execute()
File "/home/ayushs/.local/share/virtualenvs/Server-D_x4HQZH/lib/python3.7/site-packages/sqlalchemy/orm/unitofwork.py", line 422, in execute
rec.execute(self)
File "/home/ayushs/.local/share/virtualenvs/Server-D_x4HQZH/lib/python3.7/site-packages/sqlalchemy/orm/unitofwork.py", line 589, in execute
uow,
File "/home/ayushs/.local/share/virtualenvs/Server-D_x4HQZH/lib/python3.7/site-packages/sqlalchemy/orm/persistence.py", line 245, in save_obj
insert,
File "/home/ayushs/.local/share/virtualenvs/Server-D_x4HQZH/lib/python3.7/site-packages/sqlalchemy/orm/persistence.py", line 1066, in _emit_insert_statements
c = cached_connections[connection].execute(statement, multiparams)
File "/home/ayushs/.local/share/virtualenvs/Server-D_x4HQZH/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 988, in execute
return meth(self, multiparams, params)
File "/home/ayushs/.local/share/virtualenvs/Server-D_x4HQZH/lib/python3.7/site-packages/sqlalchemy/sql/elements.py", line 287, in _execute_on_connection
return connection._execute_clauseelement(self, multiparams, params)
File "/home/ayushs/.local/share/virtualenvs/Server-D_x4HQZH/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1107, in _execute_clauseelement
distilled_params,
File "/home/ayushs/.local/share/virtualenvs/Server-D_x4HQZH/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
e, util.text_type(statement), parameters, None, None
File "/home/ayushs/.local/share/virtualenvs/Server-D_x4HQZH/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1466, in _handle_dbapi_exception
util.raise_from_cause(sqlalchemy_exception, exc_info)
File "/home/ayushs/.local/share/virtualenvs/Server-D_x4HQZH/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 383, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=cause)
File "/home/ayushs/.local/share/virtualenvs/Server-D_x4HQZH/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 128, in reraise
raise value.with_traceback(tb)
File "/home/ayushs/.local/share/virtualenvs/Server-D_x4HQZH/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1179, in _execute_context
context = constructor(dialect, self, conn, *args)
File "/home/ayushs/.local/share/virtualenvs/Server-D_x4HQZH/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 743, in _init_compiled
for key in compiled_params
File "/home/ayushs/.local/share/virtualenvs/Server-D_x4HQZH/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 743, in <genexpr>
for key in compiled_params
File "/home/ayushs/.local/share/virtualenvs/Server-D_x4HQZH/lib/python3.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.py", line 487, in process
value = _python_UUID(value)
File "/usr/lib64/python3.7/uuid.py", line 157, in __init__
hex = hex.replace('urn:', '').replace('uuid:', '')
sqlalchemy.exc.StatementError: (builtins.AttributeError) 'UUID' object has no attribute 'replace'
Here is my model:
from database.shared_db import db
from sqlalchemy.dialects import postgresql
from database.shared_bycrypt import bcrypt
class AuthenticationModel(db.Model):
user_id = db.Column('UserId', postgresql.UUID, primary_key = True)
email = db.Column('Email', postgresql.TEXT, unique = False, nullable=False)
phone_no = db.Column('PhoneNo', postgresql.TEXT, unique = False, nullable=False)
password = db.Column('Password', postgresql.TEXT, unique = False, nullable=False)
def __repr__(self):
return '<User %r>' % self.user_id
#property
def password_raw(self):
raise AttributeError('password not readable')
#password_raw.setter
def password_raw(self, password):
self.password = bcrypt.generate_password_hash(password)
def verify_password(self, password):
return bcrypt.check_password_hash(self.password, password)
And here is what my database helper function:
def database_helper(self, args):
id = uuid4()
userAuth = AuthenticationModel(user_id=id, email=args['email'], phone_no=args['phone_no'], password_raw=args['password'])
userInfo = PersonalInfoModel(user_id=id, first_name=args['first_name'], last_name=args['last_name'], dob=args['dob'])
db.session.add(userAuth)
db.session.add(userInfo)
db.session.commit()
I found many examples of autogenerating UUID fields. However, if I want to create some user across multiple databases, how can I do that? Because I think I will need to be able to pass the user id to the other tables even if I autogenerate it for one of the tables. Or should I simply use a text field?
uuid4() is generating a UUID instance.
You want to pass a string for the user_id field. Convert it to a string
user_id = str(uuid4())
If you like to pass UUID instance around and get them back in the result, you should update the user_id field in your schema to:
user_id = db.Column('UserId', postgresql.UUID(as_uuid=True), primary_key=True)

SqlAlchemy: Could not locate column in row for column 'translate'

I have a problem with my endpoint in Falcon framework, I have two models Class with access to DB but when execute the seconds class, this raise an exception:
sqlalchemy.exc.NoSuchColumnError: "Could not locate column in row for column 'translate'
I don't have a 'translate' column in my database or in my object mapping.
Version:
Python 3.6.2
PyMySQL==0.7.11
SQLAlchemy==1.1.11
My Code:
endpoint:
def on_post(self, req, resp, courseid, examid):
with self.db.connect() as cnn:
mdl_party = Party(cnn)
mdl_exam = Exam(cnn)
rolecourseid = mdl_party.find_rolecourseid(roleid,courseid,examid)
if rolecourseid is None :
raise AppValidationEx("ExamDoesntExist")
take_exam_id = mdl_exam.new_user_exam(username, rolecourseid, examid)
Class Party
class Party(object):
def __init__(self, dbconnection):
self.cnn = dbconnection
def find_rolecourseid(self, roleid, courseid, examid):
s = text(''' SELECT ... ''')
cursor = self.cnn.execute(s,
p_roleid=roleid,
p_courseid=courseid,
p_examid=examid)
return cursor.first()
Class Exam
class Exam(object):
""" a user class """
def __init__(self, dbconnection):
self.cnn = dbconnection
def new_user_exam(self, username, rolecourseid, examid):
now = datetime.utcnow()
data = {
'partyRoleCourseId': rolecourseid,
'examTakeDate': now,
'examTakeStart': now,
'examId': examid,
'createdBy': username,
'createdDate': now,
'deleted': 0,
'version': 0
}
ins = partyrolecourseexam.insert().values(data)
cursor = self.cnn.execute(ins) #this raise exception
take_exam_id = cursor.inserted_primary_key[0]
Database
engine = create_engine("mysql+pymysql://%s:%s#%s/%s?charset=utf8" % DBPARAMS,
pool_size=50,
max_overflow=100,
echo=False)
metadata = MetaData()
partyrolecourseexam = Table('partyrolecourseexam', metadata,
Column("id", Integer, primary_key=True),
Column("partyRoleCourseId", Integer),
...
)
The error raise when execute the "new_user_exam" method.
if the function 'find_rolecourseid' does not execute, the method "new_user_exam" works.
All trace:
Traceback (most recent call last):
File "C:\Users\USER\dev\clexam\env\lib\site-packages\sqlalchemy\engine\result.py", line 73, in __getitem__
processor, obj, index = self._keymap[key]
KeyError: 'translate'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\USER\dev\clexam\env\lib\site-packages\sqlalchemy\engine\result.py", line 99, in __getattr__
return self[name]
File "C:\Users\USER\dev\clexam\env\lib\site-packages\sqlalchemy\engine\result.py", line 75, in __getitem__
processor, obj, index = self._parent._key_fallback(key)
File "C:\Users\USER\dev\clexam\env\lib\site-packages\sqlalchemy\engine\result.py", line 563, in _key_fallback
expression._string_or_unprintable(key))
sqlalchemy.exc.NoSuchColumnError: "Could not locate column in row for column 'translate'"
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\USER\dev\clexam\env\lib\site-packages\tornado\web.py", line 1488, in _execute
result = self.prepare()
File "C:\Users\USER\dev\clexam\env\lib\site-packages\tornado\web.py", line 2774, in prepare
self.fallback(self.request)
File "C:\Users\USER\dev\clexam\env\lib\site-packages\tornado\wsgi.py", line 277, in __call__
WSGIContainer.environ(request), start_response)
File "C:\Users\USER\dev\clexam\env\lib\site-packages\falcon\api.py", line 230, in __call__
if not self._handle_exception(ex, req, resp, params):
File "C:\Users\USER\dev\clexam\env\lib\site-packages\falcon\api.py", line 657, in _handle_exception
err_handler(ex, req, resp, params)
File "app_rest.py", line 17, in handle_errors
raise ex
File "C:\Users\USER\dev\clexam\env\lib\site-packages\falcon\api.py", line 227, in __call__
responder(req, resp, **params)
File "C:\Users\USER\dev\clexam\controllers\exam_take.py", line 32, in on_post
take_exam_id = mdl_exam.new_user_exam(username, rolecourseid, examid)
File "C:\Users\USER\dev\clexam\models\exam.py", line 43, in new_user_exam
cursor = self.cnn.execute(ins)
File "C:\Users\USER\dev\clexam\env\lib\site-packages\sqlalchemy\engine\base.py", line 945, in execute
return meth(self, multiparams, params)
File "C:\Users\USER\dev\clexam\env\lib\site-packages\sqlalchemy\sql\elements.py", line 263, in _execute_on_connection
return connection._execute_clauseelement(self, multiparams, params)
File "C:\Users\USER\dev\clexam\env\lib\site-packages\sqlalchemy\engine\base.py", line 1053, in _execute_clauseelement
compiled_sql, distilled_params
File "C:\Users\USER\dev\clexam\env\lib\site-packages\sqlalchemy\engine\base.py", line 1189, in _execute_context
context)
File "C:\Users\USER\dev\clexam\env\lib\site-packages\sqlalchemy\engine\base.py", line 1405, in _handle_dbapi_exception
util.reraise(*exc_info)
File "C:\Users\USER\dev\clexam\env\lib\site-packages\sqlalchemy\util\compat.py", line 187, in reraise
raise value
File "C:\Users\USER\dev\clexam\env\lib\site-packages\sqlalchemy\engine\base.py", line 1182, in _execute_context
context)
File "C:\Users\USER\dev\clexam\env\lib\site-packages\sqlalchemy\engine\default.py", line 470, in do_execute
cursor.execute(statement, parameters)
File "C:\Users\USER\dev\clexam\env\lib\site-packages\pymysql\cursors.py", line 164, in execute
query = self.mogrify(query, args)
File "C:\Users\USER\dev\clexam\env\lib\site-packages\pymysql\cursors.py", line 143, in mogrify
query = query % self._escape_args(args, conn)
File "C:\Users\USER\dev\clexam\env\lib\site-packages\pymysql\cursors.py", line 123, in _escape_args
return dict((key, conn.literal(val)) for (key, val) in args.items())
File "C:\Users\USER\dev\clexam\env\lib\site-packages\pymysql\cursors.py", line 123, in <genexpr>
return dict((key, conn.literal(val)) for (key, val) in args.items())
File "C:\Users\USER\dev\clexam\env\lib\site-packages\pymysql\connections.py", line 821, in literal
return self.escape(obj, self.encoders)
File "C:\Users\USER\dev\clexam\env\lib\site-packages\pymysql\connections.py", line 814, in escape
return escape_item(obj, self.charset, mapping=mapping)
File "C:\Users\USER\dev\clexam\env\lib\site-packages\pymysql\converters.py", line 27, in escape_item
val = encoder(val, mapping)
File "C:\Users\USER\dev\clexam\env\lib\site-packages\pymysql\converters.py", line 110, in escape_unicode
return u"'%s'" % _escape_unicode(value)
File "C:\Users\USER\dev\clexam\env\lib\site-packages\pymysql\converters.py", line 73, in _escape_unicode
return value.translate(_escape_table)
File "C:\Users\USER\dev\clexam\env\lib\site-packages\sqlalchemy\engine\result.py", line 101, in __getattr__
raise AttributeError(e.args[0])
AttributeError: Could not locate column in row for column 'translate'
Help and thks

Jasper Report Module on OpenERP 7

I was trying to install Jasper Report module for OpenERP 7
I got them Syleam mdule from here
https://github.com/syleam/openerp-jasperserver
and download OpenERP 7 from here
http://nightly.openerp.com/7.0/nightly/src/
I already install httplib2, pyPdf and python-dime that was required for this module.But when i try to install the module i got this error
OpenERP Server Error
Client Traceback (most recent call last): File
"/opt/openerp-7/openerp/addons/web/http.py", line 204, in dispatch
response["result"] = method(self, **self.params) File "/opt/openerp-7/openerp/addons/web/controllers/main.py", line 1132, in
call_button
action = self._call_kw(req, model, method, args, {}) File "/opt/openerp-7/openerp/addons/web/controllers/main.py", line 1120, in
_call_kw
return getattr(req.session.model(model), method)(*args, **kwargs) File "/opt/openerp-7/openerp/addons/web/session.py", line 42, in proxy
result = self.proxy.execute_kw(self.session._db, self.session._uid, self.session._password, self.model, method, args,
kw) File "/opt/openerp-7/openerp/addons/web/session.py", line 30, in
proxy_method
result = self.session.send(self.service_name, method, *args) File "/opt/openerp-7/openerp/addons/web/session.py", line 103, in send
raise xmlrpclib.Fault(openerp.tools.ustr(e), formatted_info)
Server Traceback (most recent call last): File
"/opt/openerp-7/openerp/addons/web/session.py", line 89, in send
return openerp.netsvc.dispatch_rpc(service_name, method, args) File "/opt/openerp-7/openerp/netsvc.py", line 296, in dispatch_rpc
result = ExportService.getService(service_name).dispatch(method, params) File "/opt/openerp-7/openerp/service/web_services.py", line
626, in dispatch
res = fn(db, uid, *params) File "/opt/openerp-7/openerp/osv/osv.py", line 190, in execute_kw
return self.execute(db, uid, obj, method, *args, **kw or {}) File "/opt/openerp-7/openerp/osv/osv.py", line 132, in wrapper
return f(self, dbname, *args, **kwargs) File "/opt/openerp-7/openerp/osv/osv.py", line 199, in execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw) File "/opt/openerp-7/openerp/osv/osv.py", line 187, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw) File "/opt/openerp-7/openerp/addons/base/module/module.py", line 426, in
button_immediate_install
return self._button_immediate_function(cr, uid, ids, self.button_install, context=context) File
"/opt/openerp-7/openerp/addons/base/module/module.py", line 477, in
_button_immediate_function
_, pool = pooler.restart_pool(cr.dbname, update_module=True) File "/opt/openerp-7/openerp/pooler.py", line 39, in restart_pool
registry = RegistryManager.new(db_name, force_demo, status, update_module) File "/opt/openerp-7/openerp/modules/registry.py",
line 233, in new
openerp.modules.load_modules(registry.db, force_demo, status, update_module) File "/opt/openerp-7/openerp/modules/loading.py",
line 354, in load_modules
loaded_modules, update_module) File "/opt/openerp-7/openerp/modules/loading.py", line 256, in
load_marked_modules
loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules,
perform_checks=perform_checks) File
"/opt/openerp-7/openerp/modules/loading.py", line 188, in
load_module_graph
load_data(module_name, idref, mode) File "/opt/openerp-7/openerp/modules/loading.py", line 76, in
load_data = lambda *args: _load_data(cr, *args, kind='data') File "/opt/openerp-7/openerp/modules/loading.py", line 124, in
_load_data
tools.convert_xml_import(cr, module_name, fp, idref, mode, noupdate, report) File "/opt/openerp-7/openerp/tools/convert.py",
line 959, in convert_xml_import
obj.parse(doc.getroot()) File "/opt/openerp-7/openerp/tools/convert.py", line 852, in parse
self._tags[rec.tag](self.cr, rec, n) File "/opt/openerp-7/openerp/tools/convert.py", line 812, in _tag_record
f_val = _eval_xml(self,field, self.pool, cr, self.uid, self.idref) File "/opt/openerp-7/openerp/tools/convert.py", line 154, in _eval_xml
for n in node]), idref) File "/opt/openerp-7/openerp/tools/convert.py", line 148, in _process
idref[id]=self.id_get(cr, id) File "/opt/openerp-7/openerp/tools/convert.py", line 829, in id_get
res = self.model_id_get(cr, id_str) File "/opt/openerp-7/openerp/tools/convert.py", line 838, in model_id_get
return model_data_obj.get_object_reference(cr, self.uid, mod, id_str) File "/opt/openerp-7/openerp/tools/cache.py", line 18, in
lookup
r = self.lookup(self2, cr, *args) File "/opt/openerp-7/openerp/tools/cache.py", line 46, in lookup
value = d[key] = self.method(self2, cr, *args) File "/opt/openerp-7/openerp/addons/base/ir/ir_model.py", line 876, in
get_object_reference
data_id = self._get_id(cr, uid, module, xml_id) File "/opt/openerp-7/openerp/tools/cache.py", line 18, in lookup
r = self.lookup(self2, cr, *args) File "/opt/openerp-7/openerp/tools/cache.py", line 46, in lookup
value = d[key] = self.method(self2, cr, *args) File "/opt/openerp-7/openerp/addons/base/ir/ir_model.py", line 869, in
_get_id
raise ValueError('No such external ID currently defined in the system: %s.%s' % (module, xml_id)) ValueError: No such external ID
currently defined in the system:
jasper_server.load_jrxml_file_wizard_action
Anyone can help me what happen and how to solve that ?
oh and 1 more when i try to open module jasper_server_wizard_sample i got an error too (open not install)
There is currently an open Pull Request to " install module without error about missing reference".
Maybe it's a bug and that PR fixes it.

Categories