You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/databases.md
+63-42Lines changed: 63 additions & 42 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,14 @@ The following databases are supported by this application:
8
8
- MongoDB
9
9
- ... and any other Django-supported database (via `DjangoConnector`)
10
10
11
+
DBBackup uses “connector” classes to implement backend specific dump and
12
+
restore logic. Each connector may expose additional settings documented
13
+
below.
14
+
15
+
---
16
+
17
+
## Settings Overrides
18
+
11
19
By default DBBackup reuses connection details from `settings.DATABASES`.
12
20
Sometimes you want different credentials or a different host (e.g. read-only
13
21
replica) just for backups. Use `DBBACKUP_CONNECTORS` for that purpose; it
@@ -26,9 +34,7 @@ DBBACKUP_CONNECTORS = {
26
34
This configuration will allow you to use a replica with a different host and user,
27
35
which is a great practice if you don't want to overload your main database.
28
36
29
-
DBBackup uses “connector” classes to implement backend specific dump and
30
-
restore logic. Each connector may expose additional settings documented
31
-
below.
37
+
---
32
38
33
39
## Common Settings
34
40
@@ -50,8 +56,7 @@ DBBACKUP_CONNECTORS = {
50
56
}
51
57
```
52
58
53
-
Some connectors use a command line tool as a dump engine, `mysqldump` for
54
-
example. These kinds of tools have common attributes:
59
+
Additionally, some connectors within this repository use a command line tool as a dump engine, (`MysqlDumpConnector` for example). These kinds of connectors have additional common attributes:
These connectors are provided by default and are designed to work with specific database engines. They provide optimized backup and restore functionality.
79
86
80
87
### SQLite
81
88
89
+
#### Settings
90
+
91
+
SQLite connectors do not define any configurable settings beyond the common settings documented above.
92
+
93
+
However, note that only the `SqliteConnector` supports the common `EXCLUDE` setting.
94
+
82
95
#### SqliteBackupConnector
83
96
84
97
The `dbbackup.db.sqlite.SqliteBackupConnector` makes a copy of the SQLite database file using the `.backup` command, which is safe to execute while the database has ongoing/active connections.
@@ -99,12 +112,20 @@ In-memory databases are **not** dumpable with it. Since it works by copying the
99
112
100
113
### MySQL
101
114
102
-
MySQL defaults to `dbbackup.db.mysql.MysqlDumpConnector` which shells out to
103
-
`mysqldump` for creation and `mysql` for restore.
115
+
#### Settings
104
116
105
-
### PostgreSQL
117
+
MySQL connectors do not define any configurable settings beyond the common settings documented above.
118
+
119
+
However, note that when the common `EXCLUDE` setting is configured in your Django database, each table name is passed to `mysqldump` as `--ignore-table=<database>.<table>`, so the values should be plain table
120
+
names from the target database.
121
+
122
+
#### MysqlDumpConnector
106
123
107
-
All PostgreSQL connectors have the following settings:
124
+
The `dbbackup.db.mysql.MysqlDumpConnector` creates a SQL dump with `mysqldump` and restores it by piping the dump into `mysql`.
125
+
126
+
This is the default connector for MySQL databases.
| OBJECT_CHECK | Validate documents before inserting (`--objcheck`). |`True`|
173
-
| DROP | Replace existing objects during restore (`--drop`). |`True`|
200
+
The Django connector (`dbbackup.db.django.DjangoConnector`) provides database-agnostic backup and restore functionality using Django's built-in `dumpdata` and `loaddata` management commands. This connector works with any Django-supported database backend.
174
201
175
-
### Django-Prometheus
202
+
Key features include:
176
203
177
-
All supported built-in connectors are described in more detail below. Following database wrappers from `django-prometheus` are supported:
204
+
-**Universal compatibility**: Works with any database backend supported by Django
205
+
-**No external dependencies**: Uses Django's serialization system
206
+
-**Model-level backups**: Preserves foreign key relationships and data integrity
207
+
-**JSON format**: Creates human-readable backups in JSON format
178
208
179
-
-`django_prometheus.db.backends.postgresql`
180
-
-`django_prometheus.db.backends.sqlite3`
181
-
-`django_prometheus.db.backends.mysql`
182
-
-`django_prometheus.db.backends.postgis`
209
+
The Django connector is ideal for:
183
210
184
-
## Django Connector
211
+
- Oracle databases (used by default)
212
+
- Custom or third-party database backends not explicitly supported
213
+
- Development environments where simplicity is preferred
214
+
- Cases where external database tools are not available
185
215
186
-
The Django connector (`dbbackup.db.django.DjangoConnector`) provides database-agnostic backup and restore functionality using Django's built-in `dumpdata` and `loaddata` management commands. This connector works with any Django-supported database backend.
216
+
#### DjangoConnector
187
217
188
218
This connector is automatically used for any unmapped database engines. If needed, you can explicitly configure it:
189
219
@@ -195,30 +225,21 @@ DBBACKUP_CONNECTORS = {
195
225
}
196
226
```
197
227
198
-
### Key Features
199
-
200
-
-**Universal compatibility**: Works with any database backend supported by Django
201
-
-**No external dependencies**: Uses Django's serialization system
202
-
-**Model-level backups**: Preserves foreign key relationships and data integrity
203
-
-**JSON format**: Creates human-readable backups in JSON format
204
-
205
-
### When to Use
206
-
207
-
The Django connector is ideal for:
208
-
209
-
- Oracle databases (used by default)
210
-
- Custom or third-party database backends not explicitly supported
211
-
- Development environments where simplicity is preferred
212
-
- Cases where external database tools are not available
213
-
214
-
### Limitations
228
+
#### Limitations
215
229
216
230
-**Performance**: Slower than native database tools for large datasets
217
231
-**Database structure**: Only provides backups of data; not database schema, indices, or procedures
218
232
219
-
### File Extension
233
+
### Django Prometheus (External)
234
+
235
+
All supported built-in connectors are described in more detail below. Following database wrappers from `django-prometheus` are supported:
0 commit comments