Skip to content

Commit 2d7dac4

Browse files
author
Elias Kassell
authored
Fix database action overrides (#1116)
* Fix database action overrides * Bump version
1 parent 032802e commit 2d7dac4

File tree

3 files changed

+28
-16
lines changed

3 files changed

+28
-16
lines changed

core/assertion.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,13 @@ export class Assertion {
152152
}
153153

154154
public schema(schema: string) {
155-
setNameAndTarget(this.session, this.proto, this.proto.target.name, schema);
155+
setNameAndTarget(
156+
this.session,
157+
this.proto,
158+
this.proto.target.name,
159+
schema,
160+
this.proto.target.database
161+
);
156162
return this;
157163
}
158164

core/operation.ts

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,13 @@ import {
1111
Resolvable
1212
} from "df/core/common";
1313
import { Session } from "df/core/session";
14-
import * as utils from "df/core/utils";
15-
import { checkExcessProperties, strictKeysOf } from "df/core/utils";
14+
import {
15+
checkExcessProperties,
16+
resolvableAsTarget,
17+
setNameAndTarget,
18+
strictKeysOf,
19+
toResolvable
20+
} from "df/core/utils";
1621
import { dataform } from "df/protos/ts";
1722

1823
/**
@@ -108,7 +113,7 @@ export class Operation {
108113
public dependencies(value: Resolvable | Resolvable[]) {
109114
const newDependencies = Array.isArray(value) ? value : [value];
110115
newDependencies.forEach(resolvable => {
111-
this.proto.dependencyTargets.push(utils.resolvableAsTarget(resolvable));
116+
this.proto.dependencyTargets.push(resolvableAsTarget(resolvable));
112117
});
113118
return this;
114119
}
@@ -159,7 +164,7 @@ export class Operation {
159164
}
160165

161166
public database(database: string) {
162-
utils.setNameAndTarget(
167+
setNameAndTarget(
163168
this.session,
164169
this.proto,
165170
this.proto.target.name,
@@ -170,17 +175,18 @@ export class Operation {
170175
}
171176

172177
public schema(schema: string) {
173-
utils.setNameAndTarget(this.session, this.proto, this.proto.target.name, schema);
178+
setNameAndTarget(
179+
this.session,
180+
this.proto,
181+
this.proto.target.name,
182+
schema,
183+
this.proto.target.database
184+
);
174185
return this;
175186
}
176187

177188
public compile() {
178-
if (
179-
this.proto.actionDescriptor &&
180-
this.proto.actionDescriptor.columns &&
181-
this.proto.actionDescriptor.columns.length > 0 &&
182-
!this.proto.hasOutput
183-
) {
189+
if (this.proto.actionDescriptor?.columns?.length > 0 && !this.proto.hasOutput) {
184190
this.session.compileError(
185191
new Error(
186192
"Actions of type 'operations' may only describe columns if they specify 'hasOutput: true'."
@@ -217,8 +223,8 @@ export class OperationContext implements ICommonContext {
217223
}
218224

219225
public ref(ref: Resolvable | string[], ...rest: string[]) {
220-
ref = utils.toResolvable(ref, rest);
221-
if (!utils.resolvableAsTarget(ref)) {
226+
ref = toResolvable(ref, rest);
227+
if (!resolvableAsTarget(ref)) {
222228
const message = `Action name is not specified`;
223229
this.operation.session.compileError(new Error(message));
224230
return "";
@@ -228,7 +234,7 @@ export class OperationContext implements ICommonContext {
228234
}
229235

230236
public resolve(ref: Resolvable | string[], ...rest: string[]) {
231-
return this.operation.session.resolve(utils.toResolvable(ref, rest));
237+
return this.operation.session.resolve(toResolvable(ref, rest));
232238
}
233239

234240
public dependencies(name: Resolvable | Resolvable[]) {

version.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# NOTE: If you change the format of this line, you must change the bash command
22
# in /scripts/publish to extract the version string correctly.
3-
DF_VERSION = "1.16.2"
3+
DF_VERSION = "1.16.3"

0 commit comments

Comments
 (0)