Tryton - Issues

 

Issue6838

Title Mysql backend does not have an INTERVAL type
Priority bug Status resolved
Superseder Nosy List a3arar, ced, pokoli, reviewbot, roundup-bot
Type crash Components trytond
Assigned To ced Keywords MySQL, review
Reviews 43651002
View: 43651002

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

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
New changeset 4af3076b1a6b by Cédric Krier in branch '4.4':
Add missing TYPES_MAPPING of INTERVAL for MySQL backend
http://hg.tryton.org/trytond/rev/4af3076b1a6b
New changeset 2e19dea5d2f8 by Cédric Krier in branch 'default':
Add missing TYPES_MAPPING of INTERVAL for MySQL backend
http://hg.tryton.org/trytond/rev/2e19dea5d2f8
review43651002 updated at https://codereview.tryton.org/43651002/#ps1
msg36598 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-10-29.01:05:00
Indeed rev eeab8793a918 missed to put INTERVAL in TYPES_MAPPING for mysql backend, the usage of DOUBLE for INTERVAL was already there before.
Here is review43651002
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-11-09 22:51:52roundup-botsetmessages: + msg36796
2017-10-29 21:52:38roundup-botsetstatus: testing -> resolved
nosy: + roundup-bot
messages: + msg36616
2017-10-29 01:17:44reviewbotsetnosy: + reviewbot
messages: + msg36599
2017-10-29 01:05:01cedsetstatus: chatting -> testing
reviews: 43651002
messages: + msg36598
keyword: + review
assignedto: ced
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

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