pgAdmin 4 commit: Create a template loader for SQL templates.

From: Dave Page <dpage(at)pgadmin(dot)org>
To: pgadmin-hackers(at)postgresql(dot)org
Subject: pgAdmin 4 commit: Create a template loader for SQL templates.
Date: 2017-01-30 11:33:35
Message-ID: E1cYADH-0002dT-GE@gothos.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Create a template loader for SQL templates.

This will automatically find the correct version of a template for the server version, and allows us to remove templates that were previously duplicated for different server versions.

Patch by George & Tira at Pivotal. Review by me and Murtuza from EDB.

Discussion: https://www.postgresql.org/message-id/flat/CAHowoHaU9_pkCt%2B1g8dpY3hsXXZmsJZiJH-3-_Hd%2BC1MxiGhtA%40mail(dot)gmail(dot)com#CAHowoHaU9_pkCt+1g8dpY3hsXXZmsJZiJH-3-_Hd+C1MxiGhtA(at)mail(dot)gmail(dot)com

Branch
------
master

Details
-------
http://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=19be3529f82d0ffb224d014367f7d0887d6b16f0
Author: George Gelashvili <ggelashvili.pivotal.io>

Modified Files
--------------
web/pgadmin/__init__.py | 12 ++
.../browser/server_groups/servers/__init__.py | 23 +--
.../server_groups/servers/databases/__init__.py | 10 +-
.../databases/foreign_data_wrappers/__init__.py | 5 +-
.../foreign_servers/__init__.py | 5 +-
.../foreign_servers/sql/9.3_plus/delete.sql | 9 -
.../foreign_servers/sql/9.3_plus/dependents.sql | 12 --
.../foreign_servers/sql/9.3_plus/update.sql | 87 ---------
.../foreign_data_wrappers/sql/9.3_plus/delete.sql | 8 -
.../sql/9.3_plus/handlers.sql | 5 -
.../sql/9.3_plus/validators.sql | 5 -
.../servers/databases/languages/__init__.py | 5 +-
.../templates/languages/sql/9.3_plus/create.sql | 39 ----
.../templates/languages/sql/9.3_plus/delete.sql | 8 -
.../templates/languages/sql/9.3_plus/functions.sql | 15 --
.../languages/sql/9.3_plus/properties.sql | 23 ---
.../templates/languages/sql/9.3_plus/templates.sql | 7 -
.../templates/languages/sql/9.3_plus/update.sql | 62 -------
.../servers/databases/schemas/__init__.py | 8 +-
.../servers/databases/schemas/domains/__init__.py | 5 +-
.../schemas/domains/domain_constraints/__init__.py | 5 +-
.../domain_constraints/sql/9.2_plus/delete.sql | 4 -
.../domain_constraints/sql/9.2_plus/get_domain.sql | 8 -
.../domain_constraints/sql/9.2_plus/get_oid.sql | 7 -
.../templates/domains/sql/9.2_plus/delete.sql | 16 --
.../templates/domains/sql/9.2_plus/get_oid.sql | 18 --
.../databases/schemas/foreign_tables/__init__.py | 9 +-
.../foreign_tables/sql/9.2_plus/get_oid.sql | 19 --
.../templates/foreign_tables/sql/9.2_plus/node.sql | 18 --
.../sql/9.2_plus/types_condition.sql | 14 --
.../templates/foreign_tables/sql/9.5_plus/acl.sql | 35 ----
.../foreign_tables/sql/9.5_plus/delete.sql | 17 --
.../foreign_tables/sql/9.5_plus/get_collations.sql | 9 -
.../foreign_tables/sql/9.5_plus/get_oid.sql | 19 --
.../templates/foreign_tables/sql/9.5_plus/node.sql | 18 --
.../sql/9.5_plus/types_condition.sql | 14 --
.../databases/schemas/functions/__init__.py | 8 +-
.../templates/function/pg/sql/9.2_plus/acl.sql | 35 ----
.../function/pg/sql/9.2_plus/coll_stats.sql | 20 --
.../templates/function/pg/sql/9.2_plus/delete.sql | 21 ---
.../function/pg/sql/9.2_plus/get_definition.sql | 12 --
.../function/pg/sql/9.2_plus/get_languages.sql | 4 -
.../templates/function/pg/sql/9.2_plus/get_oid.sql | 17 --
.../function/pg/sql/9.2_plus/get_out_types.sql | 6 -
.../function/pg/sql/9.2_plus/get_schema.sql | 6 -
.../function/pg/sql/9.2_plus/get_types.sql | 20 --
.../templates/function/pg/sql/9.2_plus/node.sql | 22 ---
.../templates/function/pg/sql/9.2_plus/stats.sql | 8 -
.../function/pg/sql/9.2_plus/variables.sql | 6 -
.../templates/function/pg/sql/9.5_plus/acl.sql | 35 ----
.../function/pg/sql/9.5_plus/coll_stats.sql | 20 --
.../templates/function/pg/sql/9.5_plus/delete.sql | 21 ---
.../function/pg/sql/9.5_plus/get_definition.sql | 12 --
.../function/pg/sql/9.5_plus/get_languages.sql | 4 -
.../templates/function/pg/sql/9.5_plus/get_oid.sql | 17 --
.../function/pg/sql/9.5_plus/get_out_types.sql | 6 -
.../function/pg/sql/9.5_plus/get_schema.sql | 6 -
.../function/pg/sql/9.5_plus/get_types.sql | 20 --
.../templates/function/pg/sql/9.5_plus/node.sql | 22 ---
.../templates/function/pg/sql/9.5_plus/stats.sql | 8 -
.../function/pg/sql/9.5_plus/variables.sql | 6 -
.../templates/function/ppas/sql/9.2_plus/acl.sql | 35 ----
.../function/ppas/sql/9.2_plus/coll_stats.sql | 20 --
.../function/ppas/sql/9.2_plus/get_definition.sql | 12 --
.../function/ppas/sql/9.2_plus/get_languages.sql | 4 -
.../function/ppas/sql/9.2_plus/get_out_types.sql | 6 -
.../function/ppas/sql/9.2_plus/get_schema.sql | 6 -
.../function/ppas/sql/9.2_plus/get_types.sql | 20 --
.../templates/function/ppas/sql/9.2_plus/node.sql | 23 ---
.../function/ppas/sql/9.2_plus/properties.sql | 32 ----
.../templates/function/ppas/sql/9.2_plus/stats.sql | 8 -
.../function/ppas/sql/9.2_plus/variables.sql | 6 -
.../templates/function/ppas/sql/9.5_plus/acl.sql | 35 ----
.../function/ppas/sql/9.5_plus/coll_stats.sql | 20 --
.../function/ppas/sql/9.5_plus/get_definition.sql | 12 --
.../function/ppas/sql/9.5_plus/get_languages.sql | 4 -
.../function/ppas/sql/9.5_plus/get_oid.sql | 17 --
.../function/ppas/sql/9.5_plus/get_out_types.sql | 6 -
.../function/ppas/sql/9.5_plus/get_schema.sql | 6 -
.../function/ppas/sql/9.5_plus/get_types.sql | 20 --
.../templates/function/ppas/sql/9.5_plus/node.sql | 23 ---
.../function/ppas/sql/9.5_plus/properties.sql | 32 ----
.../templates/function/ppas/sql/9.5_plus/stats.sql | 8 -
.../function/ppas/sql/9.5_plus/variables.sql | 6 -
.../templates/procedure/ppas/sql/9.2_plus/acl.sql | 35 ----
.../procedure/ppas/sql/9.2_plus/coll_stats.sql | 20 --
.../procedure/ppas/sql/9.2_plus/delete.sql | 21 ---
.../procedure/ppas/sql/9.2_plus/get_definition.sql | 12 --
.../procedure/ppas/sql/9.2_plus/get_languages.sql | 4 -
.../procedure/ppas/sql/9.2_plus/get_oid.sql | 17 --
.../procedure/ppas/sql/9.2_plus/get_out_types.sql | 6 -
.../procedure/ppas/sql/9.2_plus/get_schema.sql | 6 -
.../procedure/ppas/sql/9.2_plus/get_types.sql | 20 --
.../templates/procedure/ppas/sql/9.2_plus/node.sql | 30 ---
.../procedure/ppas/sql/9.2_plus/properties.sql | 39 ----
.../procedure/ppas/sql/9.2_plus/stats.sql | 8 -
.../procedure/ppas/sql/9.2_plus/variables.sql | 6 -
.../templates/procedure/ppas/sql/9.5_plus/acl.sql | 35 ----
.../procedure/ppas/sql/9.5_plus/coll_stats.sql | 20 --
.../procedure/ppas/sql/9.5_plus/delete.sql | 21 ---
.../procedure/ppas/sql/9.5_plus/get_definition.sql | 12 --
.../procedure/ppas/sql/9.5_plus/get_languages.sql | 4 -
.../procedure/ppas/sql/9.5_plus/get_oid.sql | 17 --
.../procedure/ppas/sql/9.5_plus/get_out_types.sql | 6 -
.../procedure/ppas/sql/9.5_plus/get_schema.sql | 6 -
.../procedure/ppas/sql/9.5_plus/get_types.sql | 20 --
.../templates/procedure/ppas/sql/9.5_plus/node.sql | 30 ---
.../procedure/ppas/sql/9.5_plus/properties.sql | 39 ----
.../procedure/ppas/sql/9.5_plus/stats.sql | 8 -
.../procedure/ppas/sql/9.5_plus/variables.sql | 6 -
.../trigger_function/pg/sql/9.2_plus/acl.sql | 35 ----
.../pg/sql/9.2_plus/coll_stats.sql | 20 --
.../pg/sql/9.2_plus/get_definition.sql | 12 --
.../pg/sql/9.2_plus/get_languages.sql | 4 -
.../pg/sql/9.2_plus/get_out_types.sql | 6 -
.../pg/sql/9.2_plus/get_schema.sql | 6 -
.../trigger_function/pg/sql/9.2_plus/get_types.sql | 20 --
.../trigger_function/pg/sql/9.2_plus/stats.sql | 8 -
.../trigger_function/pg/sql/9.2_plus/variables.sql | 6 -
.../trigger_function/pg/sql/9.5_plus/acl.sql | 35 ----
.../pg/sql/9.5_plus/coll_stats.sql | 20 --
.../trigger_function/pg/sql/9.5_plus/delete.sql | 21 ---
.../pg/sql/9.5_plus/get_definition.sql | 12 --
.../pg/sql/9.5_plus/get_languages.sql | 4 -
.../trigger_function/pg/sql/9.5_plus/get_oid.sql | 18 --
.../pg/sql/9.5_plus/get_out_types.sql | 6 -
.../pg/sql/9.5_plus/get_schema.sql | 6 -
.../trigger_function/pg/sql/9.5_plus/get_types.sql | 20 --
.../pg/sql/9.5_plus/properties.sql | 33 ----
.../trigger_function/pg/sql/9.5_plus/stats.sql | 8 -
.../trigger_function/pg/sql/9.5_plus/variables.sql | 6 -
.../trigger_function/ppas/sql/9.2_plus/acl.sql | 35 ----
.../ppas/sql/9.2_plus/coll_stats.sql | 20 --
.../ppas/sql/9.2_plus/get_definition.sql | 12 --
.../ppas/sql/9.2_plus/get_languages.sql | 4 -
.../ppas/sql/9.2_plus/get_out_types.sql | 6 -
.../ppas/sql/9.2_plus/get_schema.sql | 6 -
.../ppas/sql/9.2_plus/get_types.sql | 20 --
.../trigger_function/ppas/sql/9.2_plus/stats.sql | 8 -
.../ppas/sql/9.2_plus/variables.sql | 6 -
.../trigger_function/ppas/sql/9.5_plus/acl.sql | 35 ----
.../ppas/sql/9.5_plus/coll_stats.sql | 20 --
.../ppas/sql/9.5_plus/get_definition.sql | 12 --
.../ppas/sql/9.5_plus/get_languages.sql | 4 -
.../trigger_function/ppas/sql/9.5_plus/get_oid.sql | 18 --
.../ppas/sql/9.5_plus/get_out_types.sql | 6 -
.../ppas/sql/9.5_plus/get_schema.sql | 6 -
.../ppas/sql/9.5_plus/get_types.sql | 20 --
.../trigger_function/ppas/sql/9.5_plus/node.sql | 23 ---
.../ppas/sql/9.5_plus/properties.sql | 33 ----
.../trigger_function/ppas/sql/9.5_plus/stats.sql | 8 -
.../ppas/sql/9.5_plus/variables.sql | 6 -
.../servers/databases/schemas/packages/__init__.py | 4 +-
.../schemas/packages/edbfuncs/__init__.py | 10 +-
.../servers/databases/schemas/synonyms/__init__.py | 4 +-
.../templates/synonym/sql/9.5_plus/create.sql | 21 ---
.../templates/synonym/sql/9.5_plus/delete.sql | 8 -
.../synonym/sql/9.5_plus/get_parent_oid.sql | 5 -
.../templates/synonym/sql/9.5_plus/nodes.sql | 5 -
.../templates/synonym/sql/9.5_plus/update.sql | 10 -
.../servers/databases/schemas/tables/__init__.py | 24 +--
.../databases/schemas/tables/column/__init__.py | 6 +-
.../constraints/check_constraint/__init__.py | 18 +-
.../constraints/exclusion_constraint/__init__.py | 20 +-
.../check_constraint/sql/9.2_plus/delete.sql | 3 -
.../check_constraint/sql/9.2_plus/get_parent.sql | 7 -
.../tables/templates/column/sql/9.2_plus/acl.sql | 34 ----
.../templates/column/sql/9.2_plus/create.sql | 38 ----
.../templates/column/sql/9.2_plus/delete.sql | 1 -
.../templates/column/sql/9.2_plus/depend.sql | 9 -
.../column/sql/9.2_plus/get_inherited_tables.sql | 12 --
.../templates/column/sql/9.2_plus/get_parent.sql | 5 -
.../templates/column/sql/9.2_plus/get_position.sql | 4 -
.../templates/column/sql/9.2_plus/get_types.sql | 14 --
.../column/sql/9.2_plus/is_referenced.sql | 6 -
.../tables/templates/column/sql/9.2_plus/stats.sql | 14 --
.../exclusion_constraint/sql/9.2_plus/begin.sql | 1 -
.../exclusion_constraint/sql/9.2_plus/create.sql | 17 --
.../exclusion_constraint/sql/9.2_plus/delete.sql | 3 -
.../exclusion_constraint/sql/9.2_plus/end.sql | 1 -
.../sql/9.2_plus/get_access_methods.sql | 6 -
.../exclusion_constraint/sql/9.2_plus/get_name.sql | 3 -
.../exclusion_constraint/sql/9.2_plus/get_oid.sql | 4 -
.../sql/9.2_plus/get_oid_with_transaction.sql | 6 -
.../sql/9.2_plus/get_oper_class.sql | 7 -
.../sql/9.2_plus/get_parent.sql | 7 -
.../exclusion_constraint/sql/9.2_plus/nodes.sql | 10 -
.../sql/9.2_plus/properties.sql | 30 ---
.../exclusion_constraint/sql/9.2_plus/stats.sql | 28 ---
.../exclusion_constraint/sql/9.2_plus/update.sql | 22 ---
.../exclusion_constraint/sql/9.6_plus/begin.sql | 1 -
.../exclusion_constraint/sql/9.6_plus/create.sql | 17 --
.../exclusion_constraint/sql/9.6_plus/delete.sql | 3 -
.../exclusion_constraint/sql/9.6_plus/end.sql | 1 -
.../sql/9.6_plus/get_constraint_cols.sql | 22 ---
.../exclusion_constraint/sql/9.6_plus/get_name.sql | 3 -
.../exclusion_constraint/sql/9.6_plus/get_oid.sql | 4 -
.../sql/9.6_plus/get_oid_with_transaction.sql | 6 -
.../sql/9.6_plus/get_oper_class.sql | 7 -
.../sql/9.6_plus/get_operator.sql | 30 ---
.../sql/9.6_plus/get_parent.sql | 7 -
.../exclusion_constraint/sql/9.6_plus/nodes.sql | 10 -
.../sql/9.6_plus/properties.sql | 30 ---
.../exclusion_constraint/sql/9.6_plus/stats.sql | 28 ---
.../exclusion_constraint/sql/9.6_plus/update.sql | 22 ---
.../tables/templates/table/sql/9.5_plus/acl.sql | 46 -----
.../table/sql/9.5_plus/backend_support.sql | 18 --
.../table/sql/9.5_plus/coll_table_stats.sql | 29 ---
.../tables/templates/table/sql/9.5_plus/create.sql | 157 ----------------
.../tables/templates/table/sql/9.5_plus/delete.sql | 1 -
.../tables/templates/table/sql/9.5_plus/depend.sql | 9 -
.../table/sql/9.5_plus/enable_disable_trigger.sql | 2 -
.../table/sql/9.5_plus/get_columns_for_table.sql | 16 --
.../templates/table/sql/9.5_plus/get_inherits.sql | 17 --
.../templates/table/sql/9.5_plus/get_oftype.sql | 9 -
.../templates/table/sql/9.5_plus/get_oid.sql | 5 -
.../templates/table/sql/9.5_plus/get_relations.sql | 9 -
.../templates/table/sql/9.5_plus/get_schema.sql | 1 -
.../table/sql/9.5_plus/get_schema_oid.sql | 11 --
.../templates/table/sql/9.5_plus/get_table.sql | 8 -
.../sql/9.5_plus/get_tables_for_constraints.sql | 8 -
.../sql/9.5_plus/get_types_where_condition.sql | 10 -
.../tables/templates/table/sql/9.5_plus/nodes.sql | 7 -
.../templates/table/sql/9.5_plus/properties.sql | 65 -------
.../templates/table/sql/9.5_plus/reset_stats.sql | 1 -
.../tables/templates/table/sql/9.5_plus/sql.sql | 1 -
.../tables/templates/table/sql/9.5_plus/stats.sql | 57 ------
.../templates/table/sql/9.5_plus/truncate.sql | 1 -
.../tables/templates/table/sql/9.5_plus/update.sql | 201 ---------------------
.../servers/databases/schemas/utils.py | 13 +-
.../servers/databases/schemas/views/__init__.py | 6 +-
.../databases/sql/9.2_plus/alter_offline.sql | 22 ---
.../templates/databases/sql/9.2_plus/create.sql | 19 --
.../templates/databases/sql/9.2_plus/defacl.sql | 34 ----
.../databases/sql/9.2_plus/get_ctypes.sql | 5 -
.../templates/databases/sql/9.2_plus/nodes.sql | 12 --
.../databases/sql/9.3_plus/allowed_privs.json | 30 ---
.../templates/databases/sql/9.3_plus/create.sql | 19 --
.../templates/databases/sql/9.3_plus/delete.sql | 8 -
.../databases/sql/9.3_plus/get_ctypes.sql | 5 -
.../databases/sql/9.3_plus/get_encodings.sql | 18 --
.../templates/databases/sql/9.3_plus/nodes.sql | 12 --
.../databases/sql/9.3_plus/properties.sql | 45 -----
.../templates/databases/sql/9.3_plus/stats.sql | 33 ----
.../templates/databases/sql/9.3_plus/variables.sql | 4 -
.../server_groups/servers/tablespaces/__init__.py | 6 +-
.../templates/tablespaces/sql/9.2_plus/acl.sql | 28 ---
.../templates/tablespaces/sql/9.2_plus/alter.sql | 41 -----
.../templates/tablespaces/sql/9.2_plus/create.sql | 9 -
.../templates/tablespaces/sql/9.2_plus/delete.sql | 2 -
.../tablespaces/sql/9.2_plus/dependents.sql | 20 --
.../templates/tablespaces/sql/9.2_plus/stats.sql | 9 -
.../tablespaces/sql/9.2_plus/variables.sql | 4 -
.../servers/sql/9.2_plus/change_password.sql | 2 -
.../servers/sql/9.6_plus/change_password.sql | 2 -
web/pgadmin/browser/utils.py | 4 +-
web/pgadmin/dashboard/__init__.py | 5 +-
.../templates/dashboard/sql/9.6_plus/bio_stats.sql | 3 -
.../templates/dashboard/sql/9.6_plus/config.sql | 10 -
.../templates/dashboard/sql/9.6_plus/locks.sql | 23 ---
.../templates/dashboard/sql/9.6_plus/prepared.sql | 12 --
.../dashboard/sql/9.6_plus/session_stats.sql | 4 -
.../templates/dashboard/sql/9.6_plus/ti_stats.sql | 4 -
.../templates/dashboard/sql/9.6_plus/to_stats.sql | 3 -
.../templates/dashboard/sql/9.6_plus/tps_stats.sql | 4 -
web/pgadmin/tools/debugger/__init__.py | 1 -
web/pgadmin/tools/sqleditor/command.py | 4 +-
web/pgadmin/utils/sqlautocomplete/autocomplete.py | 4 +-
web/pgadmin/utils/tests/__init__.py | 0
.../some_feature/sql/9.1_plus/some_action.sql | 2 +
.../some_feature/sql/9.2_plus/some_action.sql | 1 +
.../utils/tests/test_versioned_template_loader.py | 47 +++++
web/pgadmin/utils/versioned_template_loader.py | 31 ++++
web/regression/utils/__init__.py | 0
web/setup.py | 1 +
275 files changed, 138 insertions(+), 4108 deletions(-)

Browse pgadmin-hackers by date

  From Date Subject
Next Message Dave Page 2017-01-30 11:33:41 Re: [Patch] Refactor sql template version picking
Previous Message Dave Page 2017-01-30 10:39:40 Re: [pgAdmin4] [PATCH] Simplify Server's python setup