Skip to content

Commit

Permalink
Add ignore-errors in db connectors
Browse files Browse the repository at this point in the history
  • Loading branch information
Loïc Knuchel committed Nov 17, 2023
1 parent 91fa2e9 commit 8996730
Show file tree
Hide file tree
Showing 49 changed files with 9,493 additions and 7,939 deletions.
1 change: 1 addition & 0 deletions cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Get the help simply by running the CLI (`npx azimutt`) or for a specific command
- `--mixed-collection` is optional, split collections given the specified field (if you have several kind of documents in the same collection)
- `--sample-size` defines how many items are used to infer a schema (for document databases)
- `--infer-relations` build relations based on column names, for example a `user_id` will have a relation if a table `users` has an `id` column
- `--ignore-errors` is optional, do not stop export on errors, just log them
- `--format` is optional, default to `json` but for relational database it could also be `sql`
- `--output` is optional, database name will be inferred from url and prefixed by the timestamp
- `--debug` allows to see the full stack trace of the error (can be helpful to debug)
Expand Down
1,403 changes: 708 additions & 695 deletions cli/package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "azimutt",
"version": "0.0.26",
"version": "0.0.27",
"description": "Export database schema from relational or document databases. Import it to https://azimutt.app",
"keywords": [
"database",
Expand Down Expand Up @@ -43,7 +43,7 @@
"dry-publish": "npm run build && npm test && npm pack"
},
"dependencies": {
"@azimutt/gateway": "^0.0.15",
"@azimutt/gateway": "^0.0.16",
"chalk": "4.1.2",
"clear": "0.1.0",
"commander": "11.0.0",
Expand Down
4 changes: 3 additions & 1 deletion cli/src/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export type Opts = {
mixedCollection: string | undefined
sampleSize: number
inferRelations: boolean
ignoreErrors: boolean
format: FileFormat
output: FilePath | undefined
}
Expand Down Expand Up @@ -39,7 +40,8 @@ async function exportJsonSchema(kind: DatabaseKind, url: DatabaseUrlParsed, opts
schema: opts.database || opts.bucket || opts.schema,
mixedCollection: opts.mixedCollection,
sampleSize: opts.sampleSize,
inferRelations: opts.inferRelations
inferRelations: opts.inferRelations,
ignoreErrors: opts.ignoreErrors
})
const schemas: string[] = [...new Set(azimuttSchema.tables.map(t => t.schema))]
const file = filename(opts.output, url, schemas, opts.format)
Expand Down
1 change: 1 addition & 0 deletions cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ program.command('export')
.option('-m, --mixed-collection <field>', 'When collection have mixed documents typed by a field')
.option('--sample-size <number>', 'Number of items used to infer a schema', safeParseInt, 10)
.option('--infer-relations', 'Infer relations using column names')
.option('--ignore-errors', 'Do not stop export on errors, just log them')
.option('-f, --format <format>', 'Output format', 'json')
.option('-o, --output <output>', "Path to write the schema, ex: ~/azimutt.json")
.option('--debug', 'Add debug logs and show the full stacktrace instead of a shorter error')
Expand Down
2 changes: 1 addition & 1 deletion cli/src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const version = '0.0.26'
export const version = '0.0.27'
Loading

0 comments on commit 8996730

Please sign in to comment.