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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 61 additions and 8 deletions

View File

@ -203,8 +203,28 @@ tab related to tables that should be included in the backup.
* Move the switch next to *With OIDs* towards right position to include object
identifiers as part of the table data for each table.
* Use the *Table and Children* field to dump the tables and any partitions
or inheritance child tables of the tables matching the table pattern. Multiple patterns
can be given separated by space. **Note:** This option is visible only
for database server greater than or equal to 16.
* Use the *Exclude table* field to not dump the tables matching the table
pattern. Multiple patterns can be given separated by space.
* Use the *Exclude table data* field to not dump data for any tables
matching the table pattern.
matching the table pattern. Multiple patterns can be given separated by
spaces.
* Use the *Exclude table and children* field to not dump the tables and any
partitions or inheritance child tables of the tables matching the table
pattern. Multiple patterns can be given separated by space. **Note:** This
option is visible only for database server greater than or equal to 16.
* Use the *Exclude table data and children* field to not dump data for the
tables and any partitions or inheritance child tables of the tables matching
the table pattern. Multiple patterns can be given separated by space.
**Note:** This option is visible only for database server greater than or
equal to 16.
Click the *Options* tab to continue. Use the fields in the *Options*
tab to provide other backup options.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 125 KiB

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(