@sqlanvil/cli 1.26.1 → 1.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bundle.js +29 -4
  2. package/package.json +1 -1
package/bundle.js CHANGED
@@ -50646,7 +50646,7 @@ function collectEvaluationQueries(queryOrAction, concatenate, queryModifier = (q
50646
50646
  .filter(validationQuery => !!validationQuery.query);
50647
50647
  }
50648
50648
 
50649
- const version = "1.26.1";
50649
+ const version = "1.27.0";
50650
50650
  const dataformVersion = "3.0.61";
50651
50651
 
50652
50652
  async function build(compiledGraph, runConfig, dbadapter) {
@@ -51518,13 +51518,22 @@ function resolveConnection(projectDir, connectionName) {
51518
51518
  if (!definition) {
51519
51519
  throw new Error(`Unknown connection "${connectionName}". Define it under \`connections:\` in workflow_settings.yaml.`);
51520
51520
  }
51521
+ const bigqueryAdcFallback = (definition.platform || "").toLowerCase() === "bigquery"
51522
+ ? { name: connectionName, definition, credentials: {} }
51523
+ : undefined;
51521
51524
  const credsPath = path__namespace.join(path__namespace.resolve(projectDir), ".df-credentials.json");
51522
51525
  if (!fs__namespace.existsSync(credsPath)) {
51526
+ if (bigqueryAdcFallback) {
51527
+ return bigqueryAdcFallback;
51528
+ }
51523
51529
  throw new Error(`Missing .df-credentials.json in ${projectDir}.`);
51524
51530
  }
51525
51531
  const allCreds = JSON.parse(fs__namespace.readFileSync(credsPath, "utf8"));
51526
51532
  const credentials = allCreds.connections && allCreds.connections[connectionName];
51527
51533
  if (!credentials) {
51534
+ if (bigqueryAdcFallback) {
51535
+ return bigqueryAdcFallback;
51536
+ }
51528
51537
  throw new Error(`No credentials for connection "${connectionName}" in .df-credentials.json ` +
51529
51538
  `(expected a "connections.${connectionName}" entry).`);
51530
51539
  }
@@ -54909,9 +54918,25 @@ async function migrateDataform(opts) {
54909
54918
  `# Generated by sqlanvil migrate-dataform: scaffold columnTypes for every converted\n` +
54910
54919
  `# declaration (${introspectCommands.length} commands). Requires BigQuery read access\n` +
54911
54920
  `# (gcloud auth application-default login). Re-runnable; then commit the changes.\n` +
54912
- `set -e\n` +
54913
- introspectCommands.join("\n") +
54914
- `\n`);
54921
+ `# Failures (e.g. stale declarations for dropped tables) are collected and\n` +
54922
+ `# summarized at the end instead of aborting the run.\n` +
54923
+ `failures=0\n` +
54924
+ `failed=""\n` +
54925
+ `run() {\n` +
54926
+ ` "$@" || {\n` +
54927
+ ` failures=$((failures + 1))\n` +
54928
+ ` failed="\${failed}\n $*"\n` +
54929
+ ` printf 'FAILED: %s\\n' "$*" >&2\n` +
54930
+ ` }\n` +
54931
+ `}\n` +
54932
+ introspectCommands.map(c => `run ${c}`).join("\n") +
54933
+ `\n` +
54934
+ `if [ "$failures" -gt 0 ]; then\n` +
54935
+ ` printf '\\n%s introspect command(s) failed:%s\\n' "$failures" "$failed" >&2\n` +
54936
+ ` printf 'Likely stale declarations (table dropped/renamed) - verify and remove them.\\n' >&2\n` +
54937
+ ` exit 1\n` +
54938
+ `fi\n` +
54939
+ `printf '\\nAll introspect commands succeeded.\\n'\n`);
54915
54940
  report.files.push({
54916
54941
  file: "scripts/introspect_all.sh",
54917
54942
  action: "generated",
package/package.json CHANGED
@@ -71,7 +71,7 @@
71
71
  "bin": {
72
72
  "sqlanvil": "bundle.js"
73
73
  },
74
- "version": "1.26.1",
74
+ "version": "1.27.0",
75
75
  "name": "@sqlanvil/cli",
76
76
  "description": "sqlanvil command line interface.",
77
77
  "main": "bundle.js"