burggraf / pb-import

Import to Pocketbase
14 stars 2 forks source link

pb-import (Pocketbase Import)

A set of Pocketbase command-line hooks to enable data import directly into your Pocketbase project's database.

CSV: Delimited Files (CSV, TSV, TXT)

Import an existing text file containing records in a delimited format into a new collection in your current Pocketbase project. The file must have a single header record containing the field names for each row in the file.

The file is parsed and analyzed to determine an appropriate data type for each field, then the collection is created, and then data is loaded into the collection.

examples

pocketbase import_csv myfile.csv mycollection
pocketbase import_csv ~/path/to/myfile.csv mycollection
pocketbase import_csv myfile.tsv mycollection
pocketbase import_csv myfile.txt mycollection

notes and warnings

SQLite: Import SQLite Databases

Import an existing SQLite database on disk into the current Pocketbase project. You can import all the tables in the external database (the default) or provide an optional list of tables to be imported. One collection is created for each table using very basic data types, then data is imported from the external SQLite database into your Pocketbase database (pb_data/data.db).

examples

Import all the tables in my SQLite database:

pocketbase import_sqlite /Users/myusername/externalDB.sqlite

Import just the tables named people and places from my database:

pocketbase import_sqlite /Users/myusername/externalDB.sqlite "'people','places'"

notes and warnings