-
Notifications
You must be signed in to change notification settings - Fork 89
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
Get project name from dbt #1469
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -174,6 +174,7 @@ export class DBTCloudProjectIntegration | |
private static QUEUE_ALL = "all"; | ||
private targetPath?: string; | ||
private version: number[] | undefined; | ||
private projectName: string = "unknown_" + crypto.randomUUID(); | ||
private adapterType: string = "unknown"; | ||
private packagesInstallPath?: string; | ||
private modelPaths?: string[]; | ||
|
@@ -376,6 +377,10 @@ export class DBTCloudProjectIntegration | |
return this.version || [0, 0, 0]; | ||
} | ||
|
||
getProjectName(): string { | ||
return this.projectName; | ||
} | ||
|
||
getPythonBridgeStatus(): boolean { | ||
return this.python.connected; | ||
} | ||
|
@@ -988,6 +993,15 @@ export class DBTCloudProjectIntegration | |
stderr, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please specify a return type for the |
||
); | ||
} | ||
const lookupValue = (lookupString: string) => { | ||
const regexString = `${lookupString}\\s*(.*)`; | ||
const regexp = new RegExp(regexString, "gm"); | ||
const matches = regexp.exec(stdout); | ||
if (matches?.length === 2) { | ||
return matches[1]; | ||
} | ||
throw new Error(`Could not find any entries for ${lookupString}`); | ||
}; | ||
const lookupEntries = (lookupString: string) => { | ||
const regexString = `${lookupString}\\s*\\[(.*)\\]`; | ||
const regexp = new RegExp(regexString, "gm"); | ||
|
@@ -1007,6 +1021,7 @@ export class DBTCloudProjectIntegration | |
this.macroPaths = lookupEntries("Macro paths").map((p) => | ||
join(this.projectRoot.fsPath, p), | ||
); | ||
this.projectName = lookupValue("Project name"); | ||
this.packagesInstallPath = join(this.projectRoot.fsPath, "dbt_packages"); | ||
} catch (error) { | ||
this.terminal.warn( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -336,6 +336,7 @@ export interface DBTProjectIntegration extends Disposable { | |
getPackageInstallPath(): string | undefined; | ||
getAdapterType(): string | undefined; | ||
getVersion(): number[] | undefined; | ||
getProjectName(): string; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Missing Several classes implementing
🔗 Analysis chainLGTM! Verify implementations of The addition of the Ensure that all classes implementing |
||
getSelectedTarget(): string | undefined; | ||
// parse manifest | ||
rebuildManifest(): Promise<void>; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -207,7 +207,7 @@ export class DBTProject implements Disposable { | |
} | ||
|
||
public getProjectName() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please specify a return type for the |
||
return this.projectConfig.name; | ||
return this.dbtProjectIntegration.getProjectName(); | ||
} | ||
|
||
getSelectedTarget() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Import the 'crypto' module
The
crypto
module is used but not imported. You need to import it to usecrypto.randomUUID()
.Apply this diff to fix the missing import:
+import * as crypto from 'crypto';