Commit Graph
66 Commits
Author SHA1 Message Date
Cédric Krier 7892f8ae56 Use declarative index definition for ModelSQL
issue5757
review361251002
2022-10-11 00:44:51 +02:00
Cédric Krier 12a3a8a9d7 Add backend documentation
issue9134
review269041003
2022-09-08 13:05:06 +02:00
Cédric Krier a5ac7ba55c Use singleton for TableHandler
issue11301
review366861002
2022-05-07 11:35:14 +02:00
Cédric Krier a0bfbfa255 Follow isort formatting
issue10928
2021-12-11 17:58:45 +01:00
Cédric Krier c6ca01b701 Support to alter more numeric types
issue10897
review381261002
2021-11-08 19:33:56 +01:00
Cédric Krier 23658d9e06 Update logging message for re-run update
issue10286
review357811002
2021-04-21 23:54:43 +02:00
Sergi Almacellas Abellana c95520b38a Concatenate cascade string to drop table before converting to SQL
issue10278
review332571002
2021-04-13 18:17:22 +02:00
Sergi Almacellas Abellana baa364f808 Only test column varchar size when set
issue10276
review338071003
2021-04-13 14:22:48 +02:00
Cédric Krier 012ca5824e Alter column type to change size on postgresql table
issue7331
2021-04-13 01:41:30 +02:00
Nicolas Évrard 2f08e73ba2 Escape identifiers in backend
issue10245
review317021002
2021-04-12 23:07:55 +02:00
Nicolas Évrard ffe62f46e8 Allow column sql types to be tested from the table handler
issue9645
review312421002
2021-04-12 20:56:08 +02:00
Cédric Krier 9c81cb6a4a Replace cursor fetchall by iteration over cursor
issue5817
review335831003
2021-03-21 16:09:13 +01:00
Cédric Krier d7ed5f91f5 Fix flake8 errors and warnings
We add the flake8 configuration used so we ensure everyone uses the same.
We remove the usage of __all__ for non public API.
When possible, we rationalize the class name according to its __name__ and module.

issue9082
review297061002
2020-03-01 12:33:54 +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 3547690d8b Allow SQL expression and where clause in index_action
issue7580
review46621002
2018-07-24 19:29:16 +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 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 036ca6d6a9 Always raise exception in table handler
issue7175
review40161002
2018-03-15 00:43:32 +01:00
Nicolas Évrard ddb7769310 Move handling of sequences to the Database object
issue6788
review43521002
2017-10-02 17:48:23 +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
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
Cédric Krier ddba34889c Prevent comparison when column size if None in TableHandler
column size could be None so in Python 3, it can not be compare to integer.

issue5661
review28361002
2016-06-30 18:35:42 +02:00
Sergi Almacellas Abellana 439194daf6 Remove uneeded cursor parameter in postgresql drop_table
Since changeset 9b2e0aac2d9c

issue5516
review23001002
2016-05-01 22:50:11 +02:00
Cédric Krier 9e57ec6627 Improve TableHandler's to update only modified property
It adds keywords argument to _update_definition to limit the update as most of
the time only one kind of property is modified.

issue5416
review22891002
2016-03-25 11:25:43 +01:00
Nicolas Évrard 2fef479575 Follow PEP-0249 for Transaction and backends
issue4949
review19781002
2016-03-03 21:51:57 +01:00
Cédric Krier 68eca37c72 Add _update_definitions after column_rename
issue5325
review16001002
2016-02-15 10:07:18 +01:00
Cédric Krier 29129855ec Add support for Python 3
issue3211
review7311002
2016-02-07 16:46:16 +01:00
Cédric Krier 109d0ef64f Manage PostgreSQL schema
Replace usage of pg_catalog tables by information_schema to take care of user
access.
Ensure to fetch the columns information from the right schema.
Prevent to update default column values if it did not change.
Comment table and column only if the current user is the owner.

issue4924
review24291002
2015-09-04 11:16:09 +02:00
Cédric Krier 44dc331ced Use Constraint instance in ModelSQL._sql_constraints
issue4814
review15491002
2015-06-22 16:57:06 +02:00
Cédric Krier 20484bb013 Fix formatting in logger calls 2015-03-05 11:32:18 +01:00
Cédric Krier 0ac0990c77 Improve logging
issue4458
review11781002
2015-03-02 23:39:15 +01:00
Cédric Krier c144f8c349 Fix most flake8 errors
review8771002
2014-12-02 12:54:01 +01:00
Cédric Krier fc6c6cfdda Migration to python-sql
* Use python-sql
* Add convert_domain method on Fields
* Add sql_format and sql_type methods on Fields
* Allow to return a full domain for Function.searcher
* Replace static backend by dynamic get method
* Replace order_field by order_<field name> method

review1001002
2013-09-06 22:32:37 +02:00
Cédric Krier 5e01f5c068 Fix flake8 2013-02-27 22:50:31 +01:00
Cédric Krier 0fe1b93864 Active Record 2012-09-24 22:16:53 +02:00
Cédric Krier ee3be37a36 Fix pep8 and pyflakes 2012-04-01 23:08:15 +02:00
Pierre-Louis Bonicoli f35f3ec546 Put quotes around sequence names
Identifiers are quoted in trytond/backend/postgresql/table.py,
sequence names must be quoted too (see
http://www.postgresql.org/docs/8.4/static/functions-sequence.html)

issue2176
review141002
2011-10-12 15:44:00 +02:00
Cédric Krier 246d18d67f Fix comparison of indexes
On MySQL the max length is 64
On PostgreSQL the max length is a build option, so we use the max length of the
known indexes

review116002
2011-09-28 18:09:30 +02:00
Cédric Krier c5c449e1a0 Fix migration speed of dates from timestamp(0) to timestamp(6) 2011-02-16 16:03:51 +01:00
Cédric Krier df1fd283ac New transaction management
Remove cursor, user and context from methods and use Transaction instead
2010-08-19 22:01:12 +02:00
Cédric Krier 483afed26a Catch only Exception according to PEP 352 2010-07-08 19:53:39 +02:00
Cédric Krier b5fb4d1ef3 Refactoring by validation with pylint 2010-02-18 18:50:35 +01:00
Cédric Krier 6961c5c925 Fix typo 2010-02-08 09:36:32 +01:00
Cédric Krier ac9c532f41 Fix wrong initialisation type of _indexes in TableHandler of PostgreSQL
backend
2010-02-08 09:36:10 +01:00
Cédric Krier d68ec64069 Use column starting with "_" in alter_size to prevent naming collision 2010-01-16 14:25:05 +01:00
Cédric Krier 1a8c6f2213 Add comment on table and field for postgresql backend 2010-01-11 12:32:50 +01:00
Cédric Krier e2f80d378c Add timestamp field in backend
Improve validation of DateTime values
2009-11-10 14:00:13 +01:00
Bertrand Chenal 7834e3849a Handle sequence and history renaming when renaming table 2009-09-16 14:47:06 +02:00
Bertrand Chenal 36efc47a44 Allow to drop constraint, index and foreign key with custom table name 2009-09-10 14:19:10 +02:00