Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove environments and schedules #1418

Merged
merged 1 commit into from
Jan 5, 2023
Merged
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
16 changes: 0 additions & 16 deletions api/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ export interface IInitResult {

export interface IInitOptions {
skipInstall?: boolean;
includeSchedules?: boolean;
includeEnvironments?: boolean;
}

export async function init(
Expand All @@ -32,8 +30,6 @@ export async function init(
const dataformJsonPath = path.join(projectDir, "dataform.json");
const packageJsonPath = path.join(projectDir, "package.json");
const gitignorePath = path.join(projectDir, ".gitignore");
const schedulesJsonPath = path.join(projectDir, "schedules.json");
const environmentsJsonPath = path.join(projectDir, "environments.json");

if (fs.existsSync(dataformJsonPath) || fs.existsSync(packageJsonPath)) {
throw new Error(
Expand Down Expand Up @@ -74,18 +70,6 @@ export async function init(
fs.writeFileSync(gitignorePath, gitIgnoreContents);
filesWritten.push(gitignorePath);

if (options.includeSchedules) {
fs.writeFileSync(
schedulesJsonPath,
prettyJsonStringify(dataform.schedules.SchedulesJSON.create({}))
);
filesWritten.push(schedulesJsonPath);
}

if (options.includeEnvironments) {
fs.writeFileSync(environmentsJsonPath, prettyJsonStringify(dataform.Environments.create({})));
}

// Make the default models, includes folders.
const definitionsDir = path.join(projectDir, "definitions");
fs.mkdirSync(definitionsDir);
Expand Down
106 changes: 0 additions & 106 deletions api/commands/validate.ts

This file was deleted.

3 changes: 0 additions & 3 deletions api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import * as query from "df/api/commands/query";
import { run, Runner } from "df/api/commands/run";
import * as table from "df/api/commands/table";
import { test } from "df/api/commands/test";
import { validateSchedules, validateSchedulesFileIfExists } from "df/api/commands/validate";

export {
init,
Expand All @@ -20,8 +19,6 @@ export {
run,
query,
table,
validateSchedules,
validateSchedulesFileIfExists,
Runner,
Builder,
prune
Expand Down
29 changes: 7 additions & 22 deletions cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,17 @@ const includeDependentsOption: INamedOption<yargs.Options> = {
},
// It would be nice to use yargs' "implies" to implement this, but it doesn't work for some reason.
check: (argv: yargs.Arguments) => {
if (argv[includeDependentsOption.name] && !(argv[actionsOption.name] || argv[tagsOption.name])) {
if (
argv[includeDependentsOption.name] &&
!(argv[actionsOption.name] || argv[tagsOption.name])
) {
throw new Error(
`The --${includeDependentsOption.name} flag should only be supplied along with --${actionsOption.name} or --${tagsOption.name}.`
);
}
}
};


const schemaSuffixOverrideOption: INamedOption<yargs.Options> = {
name: "schema-suffix",
option: {
Expand Down Expand Up @@ -208,8 +210,6 @@ const timeoutOption: INamedOption<yargs.Options> = {
const defaultDatabaseOptionName = "default-database";
const defaultLocationOptionName = "default-location";
const skipInstallOptionName = "skip-install";
const includeSchedulesOptionName = "include-schedules";
const includeEnvironmentsOptionName = "include-environments";

const testConnectionOptionName = "test-connection";

Expand Down Expand Up @@ -293,20 +293,6 @@ export function runCli() {
describe: "Whether to skip installing NPM packages.",
default: false
}
},
{
name: includeSchedulesOptionName,
option: {
describe: "Whether to initialize a schedules.json file.",
default: false
}
},
{
name: includeEnvironmentsOptionName,
option: {
describe: "Whether to initialize a environments.json file.",
default: false
}
}
],
processFn: async argv => {
Expand All @@ -320,9 +306,7 @@ export function runCli() {
useRunCache: false
},
{
skipInstall: argv[skipInstallOptionName],
includeSchedules: argv[includeSchedulesOptionName],
includeEnvironments: argv[includeEnvironmentsOptionName]
skipInstall: argv[skipInstallOptionName]
}
);
printInitResult(initResult);
Expand Down Expand Up @@ -683,7 +667,8 @@ export function runCli() {
actionResult.status !== dataform.ActionResult.ExecutionStatus.RUNNING
)
.filter(
executedAction => !alreadyPrintedActions.has(targetAsReadableString(executedAction.target))
executedAction =>
!alreadyPrintedActions.has(targetAsReadableString(executedAction.target))
)
.forEach(executedAction => {
printExecutedAction(
Expand Down
8 changes: 3 additions & 5 deletions core/targets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@ export function targetsAreEqual(a: dataform.ITarget, b: dataform.ITarget) {

/**
* Provides a readable string representation of the target which is used for e.g. specifying
* actions on the CLI or as part of schedule configs.
* actions on the CLI.
* This is effectively equivelant to an action "name".
*
*
* This is an ambiguous transformation, multiple targets may map to the same string
* and it should not be used for indexing. Use {@code targetStringifier} instead.
*/
export function targetAsReadableString(
target: dataform.ITarget
): string {
export function targetAsReadableString(target: dataform.ITarget): string {
const nameParts = [target.name, target.schema];
if (!!target.database) {
nameParts.push(target.database);
Expand Down
20 changes: 0 additions & 20 deletions protos/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,12 @@ proto_library(
name = "dataform_proto",
srcs = [
"core.proto",
"environments.proto",
"evaluation.proto",
"execution.proto",
"profiles.proto",
],
)

proto_library(
name = "schedules_proto",
srcs = ["schedules.proto"],
)

proto_library(
name = "server_proto",
srcs = ["server.proto"],
Expand All @@ -37,30 +31,18 @@ java_proto_library(
deps = [":dataform_proto"],
)

java_proto_library(
name = "schedules_java_proto",
deps = [":schedules_proto"],
)

go_proto_library(
name = "dataform_go_proto",
importpath = "github.com/dataform-co/dataform/protos/dataform",
proto = ":dataform_proto",
)

go_proto_library(
name = "schedules_go_proto",
importpath = "github.com/dataform-co/dataform/protos/dataform/schedules",
proto = ":schedules_proto",
)

load("//tools:ts_proto_library.bzl", "ts_proto_library")

ts_proto_library(
name = "ts",
deps = [
":dataform_proto",
":schedules_proto",
":server_proto",
],
)
Expand All @@ -72,8 +54,6 @@ build_test(
deps = [
":dataform_go_proto",
":dataform_java_proto",
":schedules_go_proto",
":schedules_java_proto",
],
)

Expand Down
75 changes: 0 additions & 75 deletions protos/environments.proto

This file was deleted.

1 change: 0 additions & 1 deletion protos/execution.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import "protos/core.proto";
option go_package = "github.com/dataform-co/dataform/protos/dataform";


// This is a superset of Schedule.Options.
message RunConfig {
repeated string actions = 1;
repeated string tags = 5;
Expand Down
Loading