Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export on per table basis #61

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

Export on per table basis #61

duanegran opened this issue May 9, 2016 · 5 comments
Assignees

Comments

@duanegran
Copy link

@duanegran duanegran commented May 9, 2016

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
Copy link
Owner

@sebastianfeldmann 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
Copy link
Author

@duanegran duanegran commented 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.

@sebastianfeldmann
Copy link
Owner

@sebastianfeldmann 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
Copy link
Author

@duanegran duanegran commented May 9, 2016

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

sebastianfeldmann added a commit that referenced this issue May 10, 2016
@sebastianfeldmann
Copy link
Owner

@sebastianfeldmann sebastianfeldmann commented May 10, 2016

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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.