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,
Copy link
Preview

Copilot AI Jul 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The program.skipInit value needs to be properly converted to a boolean. Commander.js may return a string or undefined for optional boolean arguments, which could cause issues. Consider using program.skipInit === true || program.skipInit === 'true' or similar boolean conversion.

Copilot uses AI. Check for mistakes.

};
}
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
4 changes: 4 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,9 @@ export const getCLIOptions = () => {
.option(
"-f, --failed-batch-output <file>",
"Path to the JSON file where failed batches will be recorded."
)
.option(
"--skip-init [true|false]",
"Whether to skip BigQuery init steps."
Comment on lines +70 to +71
Copy link
Preview

Copilot AI Jul 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The option syntax [true|false] suggests optional values, but boolean flags typically work better as simple flags without values. Consider using "--skip-init" without the value specification, or use "--skip-init <boolean>" if you want to require a value.

Suggested change
"--skip-init [true|false]",
"Whether to skip BigQuery init steps."
"--skip-init",
"Skip BigQuery init steps.",
false

Copilot uses AI. Check for mistakes.

);
};
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
Loading