Skip to content

Request adding --where to wp db export #89

@austinginder

Description

@austinginder

I see wp db export uses mysqldump. I'd like to be able to pass a --where argument to the mysqldump's where option. The would allow for a selective data dumps. Examples of how I think it should work.

Export selective posts
wp db export --tables=wp_posts --where="ID in (100,101,102)" --no-create-info

Export relating meta for selective posts
wp db export --tables=wp_postmeta --where="post_id in (100,101,102)" --no-create-info

For reference the following mysqldump does work.

mysqldump -u$(wp config get DB_USER) -p$(wp config get DB_PASSWORD) $(wp config get DB_NAME) --no-create-info --tables wp_posts --where="ID in (100,101,102)"
mysqldump -u$(wp config get DB_USER) -p$(wp config get DB_PASSWORD) $(wp config get DB_NAME) --no-create-info --tables wp_postmeta --where="post_id in (100,101,102)"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions