Skip to content
This repository was archived by the owner on Feb 16, 2023. It is now read-only.
This repository was archived by the owner on Feb 16, 2023. It is now read-only.

[Other] Convert from PostgreSQL back to SQLite? #1550

Closed

Description

@CorneliousJD

I had originally setup Paperless-ng with Postgres, however after using it for a few years my actual document-to-paperless use is less than anticipated, and I am trying to clean up my unused databases, and right now paperless-ng is the only Postgres database I have left, so I'd like to blow away postgres alltogether, but I would need to convert the data from Postgres back to SQLite. Is this possible?

Activity

  1. mskg commented on Jan 18, 2022

    @mskg

    The process described here https://paperless-ng.readthedocs.io/en/latest/setup.html also works in reverse.

  2. CorneliousJD commented on Jan 18, 2022

    @CorneliousJD
    Author

    The process described here https://paperless-ng.readthedocs.io/en/latest/setup.html also works in reverse.

    @mskg so if I try to run
    python3 manage.py dumpdata --database=postgres --exclude=contenttypes --exclude=auth.Permission > data.json

    It fails, I tried database=postgres, postgresql, pgsql and paperless (name of the DB)

    It just says the connection postgress or paperless does not exist.

    Any ideas on what command to run instead? Thanks in advance.

  3. mskg commented on Jan 18, 2022

    @mskg
    1. Just use manage dumpdata --exclude=contenttypes --exclude=auth.Permission > data.json that exports the data using known database configuration
    2. Change database configuration to sqlite
    3. Run the import command
  4. CorneliousJD commented on Jan 18, 2022

    @CorneliousJD
    Author

    Thanks, that worked. Running now back on SQLite :)

    Much appreciated.

  5. DonkiKoi commented on Jan 19, 2022

    @DonkiKoi

    You can also use the document exporter, change the database type and then import everything.

    An example with docker.

    1. All paperless container are running (db, webserver, redis).
      docker exec <container_name_webserver> document_exporter ../export.
      The document exporter exports all your data from paperless into a folder for backup or migration to another DMS.
    2. Change database configuration to sqlite.
    3. Start a complete new paperless environment but mount the export folder to it.
    4. Run the import command. docker exec <container_name_webserver> document_importer ../export
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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions