Export on per table basis #61

Closed
duanegran opened this Issue May 9, 2016 · 5 comments

Comments

Projects
None yet
2 participants
@duanegran

I'm not sure if this kind of feature is important for others, but I would find it helpful if the export (in my case, using mysql) created an SQL file per table instead of one combined file. This would be helpful for several reasons:

  1. If I need to restore a limited number of tables I wouldn't need to edit the SQL file to parse out the needed portion.
  2. Some speed concern for large files if I need to import. At the very least, I might defer importing some logging tables on my first pass to get things back up and running.
  3. I run a nightly backup that takes some non-trivial time, but I would like to run some daytime backups of just a handful of key tables. It would be a little easier to work with files with the table names already.

I can live without this and I can see potentially the feature complicating the archival and sync steps but I put it out there in case the idea benefits others too.

@sebastianfeldmann

This comment has been minimized.

Show comment
Hide comment
@sebastianfeldmann

sebastianfeldmann May 9, 2016

Owner

Sounds great and not to complicated to implement.
The only difficulty I could think of is the structureOnly/schemaOnly option for some tables.

Owner

sebastianfeldmann commented May 9, 2016

Sounds great and not to complicated to implement.
The only difficulty I could think of is the structureOnly/schemaOnly option for some tables.

@duanegran

This comment has been minimized.

Show comment
Hide comment
@duanegran

duanegran May 9, 2016

If I were to suggest how to change the configuration directive, I would make it look sort of like this:

      <target dirname="backup/mysql"
              filename="mysqldump-%Y%m%d-%H%i.sql"
              seperatetables="true"
              compress="bzip2"/>

The trick is how to reconcile this with the filename directive. Do we add a mask for it, like filename="foo-tablename.sql" or have it automatically prepend the table name to the output file if the separatetables variable is set? I tend to prefer the latter but I'm easy.

If I were to suggest how to change the configuration directive, I would make it look sort of like this:

      <target dirname="backup/mysql"
              filename="mysqldump-%Y%m%d-%H%i.sql"
              seperatetables="true"
              compress="bzip2"/>

The trick is how to reconcile this with the filename directive. Do we add a mask for it, like filename="foo-tablename.sql" or have it automatically prepend the table name to the output file if the separatetables variable is set? I tend to prefer the latter but I'm easy.

@sebastianfeldmann

This comment has been minimized.

Show comment
Hide comment
@sebastianfeldmann

sebastianfeldmann May 9, 2016

Owner

I think the target would be the wrong place to configure a MySql behaviour

<target dirname="backup/mysql"
        filename="mysqldump-%Y%m%d-%H%i.tar"
        compress="bzip2"/>

<source type="mysqldump">
  <option name="filePerTable" value="true">

Seems to be the better solution.

Mysqldump should create a directory /backup/mysql/mysqldump-%Y%m%d-%H%/
phpbu will then tar the directory to mysqldump-%Y%m%d-%H%i.tar and compress it if neccessary.

So we end up with one file for any possible sync.

Owner

sebastianfeldmann commented May 9, 2016

I think the target would be the wrong place to configure a MySql behaviour

<target dirname="backup/mysql"
        filename="mysqldump-%Y%m%d-%H%i.tar"
        compress="bzip2"/>

<source type="mysqldump">
  <option name="filePerTable" value="true">

Seems to be the better solution.

Mysqldump should create a directory /backup/mysql/mysqldump-%Y%m%d-%H%/
phpbu will then tar the directory to mysqldump-%Y%m%d-%H%i.tar and compress it if neccessary.

So we end up with one file for any possible sync.

@duanegran

This comment has been minimized.

Show comment
Hide comment
@duanegran

duanegran May 9, 2016

I prefer your config solution. Very clean and makes sense.

I prefer your config solution. Very clean and makes sense.

@sebastianfeldmann

This comment has been minimized.

Show comment
Hide comment
@sebastianfeldmann

sebastianfeldmann May 10, 2016

Owner

Hi @duanegran
I just released version 3.1.3

You can now use

<source type="mysqldump">
  <option name="filePerTable" value="true">

to create separate files per table.
All files will be stored in a directory and then tar'ed into a single file.

Hi @duanegran
I just released version 3.1.3

You can now use

<source type="mysqldump">
  <option name="filePerTable" value="true">

to create separate files per table.
All files will be stored in a directory and then tar'ed into a single file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment