Added support for excluding multiple tables while taking Backup. #7163

This commit is contained in:
Pravesh Sharma
2024-04-15 11:50:08 +05:30
committed by GitHub
parent ee0687ecd3
commit f143aa05a3
5 changed files with 61 additions and 8 deletions

View File

@@ -327,6 +327,7 @@ def _get_args_params_values(data, conn, backup_obj_type, backup_file, server,
set_value('exclude_table_data_and_children',
'--exclude-table-data-and-children', None,
manager.version >= 160000)
set_value('exclude_table', '--exclude-table')
# Disable options
set_param('disable_trigger', '--disable-triggers',

View File

@@ -658,13 +658,6 @@ export default class BackupSchema extends BaseUISchema {
}
return false;
},
}, {
id: 'exclude_table_data',
label: gettext('Exclude table data'),
type: 'text',
disabled: false,
group: gettext('Table Options'),
visible: isVisibleForServerBackup(obj.backupType)
}, {
id: 'table_and_children',
label: gettext('Table and Children'),
@@ -673,6 +666,20 @@ export default class BackupSchema extends BaseUISchema {
group: gettext('Table Options'),
min_version: 160000,
visible: isVisibleForServerBackup(obj.backupType)
}, {
id: 'exclude_table',
label: gettext('Exclude table'),
type: 'text',
disabled: false,
group: gettext('Table Options'),
visible: isVisibleForServerBackup(obj.backupType)
}, {
id: 'exclude_table_data',
label: gettext('Exclude table data'),
type: 'text',
disabled: false,
group: gettext('Table Options'),
visible: isVisibleForServerBackup(obj.backupType)
}, {
id: 'exclude_table_and_children',
label: gettext('Exclude table and children'),

View File

@@ -708,6 +708,31 @@ class BackupCreateJobTest(BaseTestGenerator):
message='--large-objects is not supported by EPAS/PG server '
'less than 16'
)),
('When backup the object with option - Exclude table',
dict(
class_params=dict(
sid=1,
name='test_backup_server',
port=5444,
host='localhost',
database='postgres',
bfile='test_backup',
username='postgres'
),
params=dict(
file='test_backup_file',
format='custom',
verbose=True,
schemas=[],
tables=[],
database='postgres',
exclude_table="table1"
),
url=BACKUP_OBJECT_URL,
expected_cmd_opts=['--exclude-table', 'table1'],
not_expected_cmd_opts=[],
expected_exit_code=[0, None]
)),
('When backup a schema with default options (< v16)',
dict(
class_params=dict(