From 469c3fc63fe961cbc457cf7b45d86aa3711c15fb Mon Sep 17 00:00:00 2001 From: Jonathan Sundqvist Date: Thu, 5 Nov 2020 09:10:45 +0100 Subject: [PATCH] using exclude-table-data instead (#363) Co-authored-by: psychok7 --- dbbackup/db/postgresql.py | 4 ++-- .../tests/test_connectors/test_postgresql.py | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/dbbackup/db/postgresql.py b/dbbackup/db/postgresql.py index b11c2734..95df6398 100644 --- a/dbbackup/db/postgresql.py +++ b/dbbackup/db/postgresql.py @@ -50,7 +50,7 @@ def _create_dump(self): cmd = cmd + create_postgres_uri(self) for table in self.exclude: - cmd += ' --exclude-table={}'.format(table) + cmd += ' --exclude-table-data={}'.format(table) if self.drop: cmd += ' --clean' @@ -113,7 +113,7 @@ def _create_dump(self): cmd += ' --format=custom' for table in self.exclude: - cmd += ' --exclude-table={}'.format(table) + cmd += ' --exclude-table-data={}'.format(table) cmd = '{} {} {}'.format(self.dump_prefix, cmd, self.dump_suffix) stdout, stderr = self.run_command(cmd, env=self.dump_env) return stdout diff --git a/dbbackup/tests/test_connectors/test_postgresql.py b/dbbackup/tests/test_connectors/test_postgresql.py index 7531eb60..6fda501f 100644 --- a/dbbackup/tests/test_connectors/test_postgresql.py +++ b/dbbackup/tests/test_connectors/test_postgresql.py @@ -78,16 +78,16 @@ def test_create_dump_user(self, mock_dump_cmd): def test_create_dump_exclude(self, mock_dump_cmd): # Without self.connector.create_dump() - self.assertNotIn(' --exclude-table=', mock_dump_cmd.call_args[0][0]) + self.assertNotIn(' --exclude-table-data=', mock_dump_cmd.call_args[0][0]) # With self.connector.exclude = ('foo',) self.connector.create_dump() - self.assertIn(' --exclude-table=foo', mock_dump_cmd.call_args[0][0]) + self.assertIn(' --exclude-table-data=foo', mock_dump_cmd.call_args[0][0]) # With serveral self.connector.exclude = ('foo', 'bar') self.connector.create_dump() - self.assertIn(' --exclude-table=foo', mock_dump_cmd.call_args[0][0]) - self.assertIn(' --exclude-table=bar', mock_dump_cmd.call_args[0][0]) + self.assertIn(' --exclude-table-data=foo', mock_dump_cmd.call_args[0][0]) + self.assertIn(' --exclude-table-data=bar', mock_dump_cmd.call_args[0][0]) def test_create_dump_drop(self, mock_dump_cmd): # Without @@ -152,16 +152,16 @@ def test_create_dump(self, mock_dump_cmd): def test_create_dump_exclude(self, mock_dump_cmd): # Without self.connector.create_dump() - self.assertNotIn(' --exclude-table=', mock_dump_cmd.call_args[0][0]) + self.assertNotIn(' --exclude-table-data=', mock_dump_cmd.call_args[0][0]) # With self.connector.exclude = ('foo',) self.connector.create_dump() - self.assertIn(' --exclude-table=foo', mock_dump_cmd.call_args[0][0]) + self.assertIn(' --exclude-table-data=foo', mock_dump_cmd.call_args[0][0]) # With serveral self.connector.exclude = ('foo', 'bar') self.connector.create_dump() - self.assertIn(' --exclude-table=foo', mock_dump_cmd.call_args[0][0]) - self.assertIn(' --exclude-table=bar', mock_dump_cmd.call_args[0][0]) + self.assertIn(' --exclude-table-data=foo', mock_dump_cmd.call_args[0][0]) + self.assertIn(' --exclude-table-data=bar', mock_dump_cmd.call_args[0][0]) def test_create_dump_drop(self, mock_dump_cmd): # Without