[GH-ISSUE #172] Better export method ? #125

Closed
opened 2026-02-25 23:33:30 +03:00 by kerem · 7 comments
Owner

Originally created by @ekianjo on GitHub (Sep 25, 2019).
Original GitHub issue: https://github.com/go-shiori/shiori/issues/172

Hi, not a feature request per se, but I am wondering if one decides to change from sqlite to an actual db later on, what would be the appropriate way to do it without losing data? Could this be documented in the wiki at some point?

Originally created by @ekianjo on GitHub (Sep 25, 2019). Original GitHub issue: https://github.com/go-shiori/shiori/issues/172 Hi, not a feature request per se, but I am wondering if one decides to change from sqlite to an actual db later on, what would be the appropriate way to do it without losing data? Could this be documented in the wiki at some point?
kerem 2026-02-25 23:33:30 +03:00
Author
Owner

@bvp commented on GitHub (Sep 25, 2019):

@ekianjo Hi
Why not use export/import?

<!-- gh-comment-id:534874436 --> @bvp commented on GitHub (Sep 25, 2019): @ekianjo Hi Why not use export/import?
Author
Owner

@ekianjo commented on GitHub (Sep 25, 2019):

@bvp I am fine using that, if it's confirmed to work out of the box. Just wondering if this is tried and tested?

<!-- gh-comment-id:534882942 --> @ekianjo commented on GitHub (Sep 25, 2019): @bvp I am fine using that, if it's confirmed to work out of the box. Just wondering if this is tried and tested?
Author
Owner

@RadhiFadlillah commented on GitHub (Sep 25, 2019):

@ekianjo this is a good point, actually.

Right now when switching database all data will not be moved to the new database. And, unfortunately export is not really suitable because it will only give Netscape Bookmark file which only contain title, URL and tag. So, the excerpt, cached content and bookmark's ID (which is vital for specifying the thumbnail and archive) won't be exported.

With that said, I think the best direction is to split export to several sub commands. This way, we can also add other export format like static files as specified in #40.

I guess the command might look like this :

$ shiori export -h

Export bookmarks into another format

Usage:
  shiori export [command]

Available Commands:
  netscape      Export into Netscape Bookmark File
  sqlite        Export into SQL file with SQLite syntax
  mysql         Export into SQL file with MySQL syntax
  postgresql    Export into SQL file with PostgreSQL syntax
  static        Export into static files

Flags:
  -h, --help   help for export

Global Flags:
      --portable   run shiori in portable mode
<!-- gh-comment-id:534934250 --> @RadhiFadlillah commented on GitHub (Sep 25, 2019): @ekianjo this is a good point, actually. Right now when switching database all data will not be moved to the new database. And, unfortunately `export` is not really suitable because it will only give Netscape Bookmark file which only contain title, URL and tag. So, the excerpt, cached content and bookmark's ID (which is vital for specifying the thumbnail and archive) won't be exported. With that said, I think the best direction is to split export to several sub commands. This way, we can also add other export format like static files as specified in #40. I guess the command might look like this : ``` $ shiori export -h Export bookmarks into another format Usage: shiori export [command] Available Commands: netscape Export into Netscape Bookmark File sqlite Export into SQL file with SQLite syntax mysql Export into SQL file with MySQL syntax postgresql Export into SQL file with PostgreSQL syntax static Export into static files Flags: -h, --help help for export Global Flags: --portable run shiori in portable mode ```
Author
Owner

@ekianjo commented on GitHub (Sep 25, 2019):

Sounds like a good solution.

<!-- gh-comment-id:535009542 --> @ekianjo commented on GitHub (Sep 25, 2019): Sounds like a good solution.
Author
Owner

@deanishe commented on GitHub (Sep 25, 2019):

If the idea is to re-import the file, I think JSON would be a better solution.

Exporting SQL is great for backup purposes, and every RDBMS can easily export its own flavour of SQL, but it'd be tricky to export MySQL-flavoured SQL from a SQLite database, for example.

I would suggest:

netscape    Export Netscape bookmark file
sql         Export SQL file for current database
json        Export Shiori JSON
archive     Export all Shiori data as a .tgz file

Whereby Shiori can also import any of the formats, but the SQL would only be compatible with the same kind of database it was exported from. The other formats would be database-agnostic.

<!-- gh-comment-id:535191305 --> @deanishe commented on GitHub (Sep 25, 2019): If the idea is to re-import the file, I think JSON would be a better solution. Exporting SQL is great for backup purposes, and every RDBMS can easily export its own flavour of SQL, but it'd be tricky to export MySQL-flavoured SQL from a SQLite database, for example. I would suggest: ``` netscape Export Netscape bookmark file sql Export SQL file for current database json Export Shiori JSON archive Export all Shiori data as a .tgz file ``` Whereby Shiori can also import any of the formats, but the SQL would only be compatible with the same kind of database it was exported from. The other formats would be database-agnostic.
Author
Owner

@ekianjo commented on GitHub (Sep 26, 2019):

@deanishe so how do you import a SQL export ? Is there a SQL export format that works for all kinds of RDBMS?

<!-- gh-comment-id:535468933 --> @ekianjo commented on GitHub (Sep 26, 2019): @deanishe so how do you import a SQL export ? Is there a SQL export format that works for all kinds of RDBMS?
Author
Owner

@deanishe commented on GitHub (Sep 26, 2019):

so how do you import a SQL export ?

You pass it straight through to the database engine. It's probably not worth the bother implementing in your own application, however, as every RDBMS comes with tools for backing up & restoring databases, and it's literally a one-liner.

Is there a SQL export format that works for all kinds of RDBMS?

No. Each RDBMS only really speaks its own dialect of SQL, and you can't get one to emit SQL that another understands without (often complex) pre-processing.

As Shiori already knows how to convert its data models to/from JSON, it's probably easiest to use JSON(lines) as the intermediate format for migrating from one database to another.

<!-- gh-comment-id:535588998 --> @deanishe commented on GitHub (Sep 26, 2019): > so how do you import a SQL export ? You pass it straight through to the database engine. It's probably not worth the bother implementing in your own application, however, as every RDBMS comes with tools for backing up & restoring databases, and it's literally a one-liner. > Is there a SQL export format that works for all kinds of RDBMS? No. Each RDBMS only really speaks its own dialect of SQL, and you can't get one to emit SQL that another understands without (often complex) pre-processing. As Shiori already knows how to convert its data models to/from JSON, it's probably easiest to use JSON(lines) as the intermediate format for migrating from one database to another.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/shiori#125
No description provided.