Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions firestore-bigquery-export/scripts/import/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,12 @@ const questions = [
name: "failedBatchOutput",
type: "input",
},
{
message: "Would you like to skip BigQuery init steps?",
name: "skipInit",
type: "confirm",
default: false,
},
];

export async function parseConfig(): Promise<CliConfig | CliConfigError> {
Expand Down Expand Up @@ -270,6 +276,7 @@ export async function parseConfig(): Promise<CliConfig | CliConfigError> {
rawChangeLogName,
cursorPositionFile,
failedBatchOutput: program.failedBatchOutput,
skipInit: program.skipInit === true || program.skipInit === 'true',
};
}
const {
Expand All @@ -285,6 +292,7 @@ export async function parseConfig(): Promise<CliConfig | CliConfigError> {
useNewSnapshotQuerySyntax,
useEmulator,
failedBatchOutput,
skipInit,
} = await inquirer.prompt(questions);

const rawChangeLogName = `${table}_raw_changelog`;
Expand All @@ -311,6 +319,7 @@ export async function parseConfig(): Promise<CliConfig | CliConfigError> {
rawChangeLogName,
cursorPositionFile,
failedBatchOutput,
skipInit,
};
}

Expand Down
5 changes: 4 additions & 1 deletion firestore-bigquery-export/scripts/import/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,12 @@ const run = async (): Promise<number> => {
useNewSnapshotQuerySyntax,
bqProjectId: bigQueryProjectId,
transformFunction: config.transformFunctionUrl,
skipInit: config.skipInit,
});

await initializeDataSink(dataSink, config);
if (!config.skipInit) {
await initializeDataSink(dataSink, config);
}

logs.importingData(config);
if (multiThreaded && queryCollectionGroup) {
Expand Down
5 changes: 5 additions & 0 deletions firestore-bigquery-export/scripts/import/src/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,10 @@ export const getCLIOptions = () => {
.option(
"-f, --failed-batch-output <file>",
"Path to the JSON file where failed batches will be recorded."
)
.option(
"--skip-init",
"Whether to skip BigQuery init steps.",
false
);
};
1 change: 1 addition & 0 deletions firestore-bigquery-export/scripts/import/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface CliConfig {
cursorPositionFile: string;
failedBatchOutput?: string;
transformFunctionUrl?: string;
skipInit: boolean;
}

export interface CliConfigError {
Expand Down