Commit Graph
289 Commits
Author SHA1 Message Date
Cédric Krier 246c672073 Remove unique constraint on ir.translation
issue8034
review46721002
2019-02-13 10:27:32 +01:00
Cédric Krier 0d15afb90e Add coroutine concurrency option
issue8010
review53501002
2019-02-05 19:09:53 +01:00
Cédric Krier 62f175d3d1 Set flavor in SQLite database init and test
Those methods use python-sql to make queries but they can be called with a
simple connection and not under a Transaction.
2019-01-28 10:03:47 +01:00
Cédric Krier 889b1cc9f8 Allow to search and order on Dict key value
issue7905
review62391002
2019-01-18 11:32:47 +01:00
Cédric Krier 342bc9f13d Correctly rename column with SQLite
The table must be recreated if the target column does not exist.
Also temporary column name should use double underscore as module may use
single underscore.

issue7978
review52591002
2019-01-15 11:30:20 +01:00
Cédric Krier 8e9c476e6f Use correct number arguments in rename column warning
issue7688
review47701002
2018-09-28 17:24:01 +02:00
Cédric Krier a6a7325f46 Remove deprecation warning
- remove invalid escape sequence
- use  read_file instead of read_fp
- use importlib instead of imp and __import__
- use callable instead of instance of collections.Callable
- fix silent file closing
- replace SafeConfigParser by ConfigParser
- replace decodestring by decodebytes
- replace encodestring by encodebytes

issue7666
issue7390
review53361004
2018-09-01 17:06:28 +02:00
Nicolas Évrard eb04b82822 Add bus management
issue7537
review66341002
2018-08-30 11:15:01 +02:00
Cédric Krier c37f12834e Use a copied list to iterate on databases
The close method pop the database from the list during the iteration which
will change the size of the dict.

issue7639
review70331002
2018-08-27 10:43:08 +02:00
Cédric Krier ae06a8bca2 Add transactional queue and workers
issue7406
review45461002
2018-07-27 09:32:28 +02:00
Cédric Krier 3547690d8b Allow SQL expression and where clause in index_action
issue7580
review46621002
2018-07-24 19:29:16 +02:00
Cédric Krier 283b3970f8 Do not keep unused database for 30 minutes
This prevents to keep the minimal connection on database that are not used
anymore. And set minimal connection to 0 for template1

issue7531
review62261002
2018-07-10 17:56:44 +02:00
Cédric Krier d2a461390a Remove support for Python 2.7
issue7497
review53261002
2018-06-26 19:11:19 +02:00
Cédric Krier 1fc70d083d Use server_version from psycopg2 connection object
instead of executing a statement and manage our own cache.

issue7465
review51311002
2018-06-04 19:05:25 +02:00
Cédric Krier 0aed819d47 Add hostname configuration to list database
issue7375
review44991002
2018-05-22 23:42:35 +02:00
Cédric Krier df4e5f0cb0 Replace day and month by 1 in date_trunk for SQLite
The value 0 is not valid for day and month.

issue7263
review45311002
2018-03-27 22:14:01 +02:00
Cédric Krier 7ae6a23128 Add non-standard exclude constraint in TableHandler definition
PostgreSQL does not include non-standard constraints in the
information_schema.table_constraints view.

issue7244
review37121002
2018-03-22 10:40:52 +01:00
Cédric Krier b3ca13748b Add Exclude constraint
issue1422
review44061002
2018-03-19 16:57:49 +01:00
Nicolas Évrard acdbe5a08f Allow to perform unaccented searches on Char fields
issue7115
review44611002
2018-03-16 18:17:53 +01:00
Cédric Krier 036ca6d6a9 Always raise exception in table handler
issue7175
review40161002
2018-03-15 00:43:32 +01:00
Cédric Krier e778370e02 Ensure to put back the connection with a try/finally
This prevents to leak connection in the ThreadedConnectionPool of psycopg2.

issue7137
review39181002
2018-02-19 19:11:33 +01:00
Cédric Krier 8a7953bb8f Use proper SQL types
- When recreating the table to drop a column, the correct SQL type must be
  converted by the database.
- SQLite uses BOOLEAN as base type for BOOL

issue7120
review37001002
2018-02-19 19:07:30 +01:00
Cédric Krier b32d158d10 Remove MySQL backend
issue7017
review41771002
2018-01-24 20:12:42 +01:00
Cédric Krier f1c4e19155 Improve support of date_trunc for SQLite backend
issue7030
review40891002
2018-01-08 19:24:39 +01:00
Cédric Krier 473ac78eb4 Add exceptional parent language
issue6956
review40821003
2017-11-25 22:00:24 +01:00
Cédric Krier 291beaa10c Wait for the database accepting connection to run tests
issue6844
review43671002
2017-10-30 09:36:10 +01:00
Cédric Krier 858fc93814 Add missing TYPES_MAPPING of INTERVAL for MySQL backend
changeset eeab8793a918 missed to move the mapping of INTERVAL to DOUBLE for
MySQL backend.

issue6838
review43651002
2017-10-29 21:52:33 +01:00
Sergi Almacellas Abellana 49f6691b60 Add missing primary key for cache table on mysql backend
issue6840
review42731002
2017-10-16 13:34:05 +02:00
Nicolas Évrard 06c4fe4868 Add support for PosgreSQL version >= 10 sequences
issue6789
review43531002
2017-10-02 17:59:16 +02:00
Nicolas Évrard ddb7769310 Move handling of sequences to the Database object
issue6788
review43521002
2017-10-02 17:48:23 +02:00
Sergi Almacellas Abellana 730ecb68b2 Implement alter_type and alter_size for sqlite backend
issue6730
review38591002
2017-09-20 11:29:12 +02:00
Cédric Krier 07d293caf8 Add support test database cache for remote postgresql
If pg_dump/pg_restore are not available, we create a copy of the database on
PostgreSQL server using the template option of "CREATE DATABASE". We still
create a file in the cache folder to know that there is a backup.

issue6699
2017-08-15 00:21:45 +02:00
Sergi Almacellas Abellana b637c503e7 Only convert dict fields when they are strings
issue6382
review28101002
2017-06-09 13:22:42 +02:00
Cédric Krier 9136ecf206 Encode data name if it is an unicode
In Python3 hashlib works only with bytes.
2017-05-12 12:42:35 +02:00
Cédric Krier 4520afedd3 Convert into hash too long data name
Some back-ends have constraint on the length of data name, they usually
silently truncate them, but this can create collision. The solution is to hash
the name when it is too long.

issue4620
issue6494
review37381003
2017-05-12 12:00:44 +02:00
Nicolas Évrard 12824d6457 Reset the database list cache on the right class
issue6429
review35371003
2017-04-17 00:17:09 +02:00
Sergi Almacellas Abellana 5b86281166 Add missing types mapping for Postgresql backend
issue6411
review34071002
2017-04-03 13:11:07 +02:00
Cédric Krier 826f30219d Re-use method as default parameter of TableHandler add_column
There is no guarantee that the method will not raise a database error on the
first registration because it can rely on other tables being registered.
So the method must be called only when needed. This is when the table already
exists and has records. In this case other tables also already exist.

issue6409
2017-04-01 16:14:36 +02:00
Nicolas Évrard aa9c9cc9e7 Use sql type instead of field related argument in the column creation
issue6348
review26231002
2017-03-31 13:21:51 +02:00
Nicolas Évrard 5cee718423 Move low level handling of the SQL type to the backend
This changeset defines on the field the (somehow) abstract SQL type a field
should use letting the duty of specifying the real SQL type the database
supports and the conversion to/from the python types to the backend.

issue6351
review33951002
2017-03-31 12:44:22 +02:00
Nicolas Évrard c3f69d1db7 Add NULLS ordering
issue5858
review27651002
2017-03-29 23:12:01 +02:00
Sergi Almacellas Abellana a78cffdad4 Support position argument of Trim function in sqlite
The position argument is not suported on sqlite but the LTRIM and RTRIM
function are used instead.

issue6378
review31221002
2017-03-22 11:59:29 +01:00
Sergi Almacellas Abellana 6575419cc9 Add window functions on Database
issue6355
review33961002
2017-03-22 10:49:26 +01:00
Nicolas Évrard f207968ba8 Remove assert on scheme from postgresql and mysql backends
issue6349
review27191002
2017-03-14 11:13:21 +01:00
Cédric Krier 631c9782a3 Use proper timezone value for MySQL
issue6224
review32021002
2017-02-11 19:05:18 +01:00
Cédric Krier 601b8218e3 Do not log, as error, exception in cursor execute
There are expected exceptions that should not be logged and the others should
be logged by the caller.

issue6211
review26101002
2017-02-08 10:22:40 +01:00
Cédric Krier 9a1e636954 Initialize earlier the ir_cache table
As now the cache is managed by the Transaction, when creating the database for
the tests, the ir_cache table should be present before the registration of the
ir module. Also the transactions to create or drop the database should not have
cache because either the database is not created at the start or dropped at the
commit.

issue6216
review29171003
2017-02-02 13:14:19 +01:00
Cédric Krier 7004574de7 Add logging on cursor execute
issue6211
review34651002
2017-02-02 12:06:55 +01:00
Cédric Krier 1b3dbec3b4 Ensure only one connection pool is created per database
It is too complex and expensive to lazy create the connection pool because all
methods which uses the pool needs to acquire a lock. So it is easier to create
it when the instance is also created. In this case, on closing the database, it
should be unregistered from the instances dictionary.

issue6202
review32991002
2017-01-29 01:15:45 +01:00
Cédric Krier c1b8ee10c6 Add has_select_for on Database
- Use has_select_for for ir.sequence.strict instead of lock

issue6134
review32911002
2017-01-25 23:21:57 +01:00