Skip to content

[feature request] sqlite db as an additional format for the export command  #6001

Closed as not planned

Description

@vadimkantorov

Sqlite integration is rapidly developing in:

It would be nice to have wp-cli natively supporting export of an existing WordPress installation as a single sqlite db file (an option to inclide any files in wp-uploads would also be great). Unfortunately, DDL and even the INSERT statements as exported by mysqldump cannot be piped into sqlite as is (e.g. for strings, backslash-escaped single quotes are used by mysqldump without a way to fix this: https://bugs.mysql.com/bug.php?id=65941 and because of DDL incompat, awk hack scripts like https://github.com/mysql2sqlite/mysql2sqlite and sed "s/\\\'/''/g" to_fix_backslash_escaping_single_quotes_in_insert_statements_of_data_dump.sql for postprocessing Mysql sql dumps are needed). So for avoiding hacks and a tested, streamlined experience, native support in wp-cli of direct export into a sqlite db file would be a great addition. In the meanwhile the Sqlite integration is developing, this export format can be a more compact than current xml format in https://developer.wordpress.org/cli/commands/export/ . In future, when sqlite integration is ready, this export mode will also be immediately useful to do conversion of WP installations from mysql to sqlite. Also a switch for command wp db export backup.sql to produce sqlite-dialected SQL files would be nice, but also directly producing a binary sqlite-db file would be more performant in many tasks (especially if many blobs are stored in the WP installation and would need to be exported in the db)

Also then a great tool https://sqlitebrowser.org/ can be used for inspecting the database.

Maybe outside of scope of wp-cli per se, but also a similar functionality would be very welcome for the UI of WordPress admin panel, as not always we have wp-cli access to the databases in cheap hosted WP installations.

A corresponding import functionality would also be very nice for importing from such sqlite-db-format backups in addition to xml/wxr backups.

Originally discussed here:

Activity

  1. danielbachhuber commented on Oct 10, 2024

    @danielbachhuber
    Member

    Thanks for the suggestion, @vadimkantorov !

    Feel free to drop your thoughts on this existing issue for the topic: wp-cli/db-command#327

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions