Tryton - Issues

 

Issue6838

Title Mysql backend does not have an INTERVAL type
Priority bug Status chatting
Superseder Nosy List a3arar, ced, pokoli
Type crash Components trytond
Assigned To Keywords MySQL
Reviews

Created on 2017-10-11.14:53:52 by a3arar, last changed by a3arar.

Files
File name Uploaded Type Edit Remove
unnamed a3arar, 2017-10-11.16:39:54 text/plain
unnamed a3arar, 2017-10-11.18:51:50 text/plain
Messages
msg36229 (view) Author: [hidden] (a3arar) Date: 2017-10-11.18:51:50
Thank you Sergi and Cedric.. I ended up installing PostgreSQL and would
suffer the learning curve on a new DBMS until later.  It is up and running
and now to the fun.
Thanks again,

*Ali Arar*
*917-861-1990*

On Wed, Oct 11, 2017 at 11:41 AM, Sergi Almacellas Abellana <
issue_tracker@tryton.org> wrote:

>
> Sergi Almacellas Abellana <sergi@koolpi.com> added the comment:
>
> Indeed the problem is about mysql that it does not have any INTERVAL type:
>
> https://bugs.mysql.com/bug.php?id=20844
>
> I'm not sure if it's worth to use the TIME datatype as sugested on:
>
> https://stackoverflow.com/questions/4037777/interval-
> datatype-in-mysql#4037845
>
> This will allow to store datetimes up to 838 hours ( nearly 35 days).
>
> ----------
> component: +trytond
> keyword: +MySQL
> title: Database Initialization -> Mysql backend does not have an INTERVAL
> type
>
> _______________________________________________
> Tryton issue tracker <issue_tracker@tryton.org>
> <https://bugs.tryton.org/issue6838>
> _______________________________________________
>
msg36222 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-10-11.17:59:24
TIME would be the wrong type.
As MySQL does not support the standard INTERVAL type, we must manage it like for SQLite as a float in seconds.
msg36220 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2017-10-11.17:41:16
Indeed the problem is about mysql that it does not have any INTERVAL type:

https://bugs.mysql.com/bug.php?id=20844

I'm not sure if it's worth to use the TIME datatype as sugested on: 

https://stackoverflow.com/questions/4037777/interval-datatype-in-mysql#4037845

This will allow to store datetimes up to 838 hours ( nearly 35 days).
msg36217 (view) Author: [hidden] (a3arar) Date: 2017-10-11.16:39:54
Thank you for the quick response.  I did create another issue for the
ir_cache table.
Please keep me informed with the timedelta fix.
I will be using PostgreSQL and see if there are any issues there.
Thanks

*Ali Arar*
*917-861-1990*

On Wed, Oct 11, 2017 at 9:41 AM, Sergi Almacellas Abellana <
issue_tracker@tryton.org> wrote:

>
> Sergi Almacellas Abellana <sergi@koolpi.com> added the comment:
>
> @a3arar can you propose a review for the bug in the ir_cache table?
>
> The process is explained here: http://www.tryton.org/how-to-
> contribute.html
>
> I think we should create another issue for the other problem, which it
> seem related to the timedelta field.
>
> ----------
> nosy: +pokoli
>
> _______________________________________________
> Tryton issue tracker <issue_tracker@tryton.org>
> <https://bugs.tryton.org/issue6838>
> _______________________________________________
>
msg36212 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2017-10-11.15:41:33
@a3arar can you propose a review for the bug in the ir_cache table? 

The process is explained here: http://www.tryton.org/how-to-contribute.html

I think we should create another issue for the other problem, which it seem related to the timedelta field.
msg36208 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-10-11.15:06:25
Lowering the priority because mysql backend is really not a priority has it has many issues.
msg36207 (view) Author: [hidden] (a3arar) Date: 2017-10-11.14:53:52
While initializing the database with MySQL, I found one bug in table creation while creating ir_cache table.  The id has to be set to primary key otherwise the script will not proceed.
After resolving that, the scrip kept populating the database with tables until i received the error below.  After the process reached ir.module.activate_upgrade, one of the either ir.cache, ir.date, or ir.trigger has a syntax error in the SQL.  I couldn't find it.  Please help.
Thanks
==============================================================================================

3794 140060523427584 [2017-10-11 12:38:55,019] INFO trytond.modules ir:register ir.module.activate_upgrade.done
3794 140060523427584 [2017-10-11 12:38:55,023] INFO trytond.modules ir:register ir.cache
3794 140060523427584 [2017-10-11 12:38:55,030] INFO trytond.modules ir:register ir.date
3794 140060523427584 [2017-10-11 12:38:55,034] INFO trytond.modules ir:register ir.trigger
Traceback (most recent call last):
  File "/home/erp/ENV/bin/trytond-admin", line 21, in <module>
    admin.run(options)
  File "/home/erp/ENV/lib/python2.7/site-packages/trytond/admin.py", line 53, in run
    pool.init(update=options.update, lang=list(lang))
  File "/home/erp/ENV/lib/python2.7/site-packages/trytond/pool.py", line 155, in init
    lang=lang)
  File "/home/erp/ENV/lib/python2.7/site-packages/trytond/modules/__init__.py", line 451, in load_modules
    _load_modules()
  File "/home/erp/ENV/lib/python2.7/site-packages/trytond/modules/__init__.py", line 421, in _load_modules
    load_module_graph(graph, pool, update, lang)
  File "/home/erp/ENV/lib/python2.7/site-packages/trytond/modules/__init__.py", line 244, in load_module_graph
    cls.__register__(module)
  File "/home/erp/ENV/lib/python2.7/site-packages/trytond/ir/trigger.py", line 81, in __register__
    super(Trigger, cls).__register__(module_name)
  File "/home/erp/ENV/lib/python2.7/site-packages/trytond/model/modelsql.py", line 161, in __register__
    table.add_column(field_name, field._sql_type, default=default)
  File "/home/erp/ENV/lib/python2.7/site-packages/trytond/backend/mysql/table.py", line 236, in add_column
    (self.table_name, column_name, column_type))
  File "/home/erp/ENV/lib/python2.7/site-packages/MySQLdb/cursors.py", line 250, in execute
    self.errorhandler(self, exc, value)
  File "/home/erp/ENV/lib/python2.7/site-packages/MySQLdb/connections.py", line 50, in defaulterrorhandler
    raise errorvalue
_mysql_exceptions.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTERVAL' at line 1")
History
Date User Action Args
2017-10-11 18:51:50a3ararsetfiles: + unnamed
messages: + msg36229
2017-10-11 17:59:24cedsetmessages: + msg36222
2017-10-11 17:41:16pokolisetcomponent: + trytond
messages: + msg36220
keyword: + MySQL
title: Database Initialization -> Mysql backend does not have an INTERVAL type
2017-10-11 16:39:54a3ararsetfiles: + unnamed
messages: + msg36217
2017-10-11 15:41:34pokolisetnosy: + pokoli
messages: + msg36212
2017-10-11 15:06:25cedsetpriority: critical -> bug
status: unread -> chatting
type: crash
messages: + msg36208
nosy: + ced
2017-10-11 14:53:52a3ararcreate

Showing 10 items. Show all history (warning: this could be VERY long)