This repository has been archived by the owner on May 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Doc String suggestions in DDBT schema-gen (#35)
* doc file type and filesystem * Add doc suggestions to schema gen * WIP for suggested docs * split doc suggestions graph execution with mutex * Add user prompt and write to file * update file pointers and user prompt * formatting * prompt improvements * remove obselete test * increment version * update emojis and formatting * move completion statement * Restore utils_test.go * use map to search for column name * Add new method to unmark graph run status Co-authored-by: Ibrahim Faruqi <[email protected]>
- Loading branch information
1 parent
15c1f9d
commit e33d08f
Showing
7 changed files
with
233 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package fs | ||
|
||
import ( | ||
"io/ioutil" | ||
"path/filepath" | ||
"strings" | ||
"sync" | ||
) | ||
|
||
type DocFile struct { | ||
Name string | ||
Path string | ||
Contents string | ||
|
||
mutex sync.Mutex | ||
} | ||
|
||
func newDocFile(path string) *DocFile { | ||
return &DocFile{ | ||
Name: strings.TrimSuffix(filepath.Base(path), ".md"), | ||
Path: path, | ||
Contents: "", | ||
} | ||
} | ||
|
||
func (d *DocFile) GetName() string { | ||
return d.Name | ||
} | ||
|
||
func (d *DocFile) Parse(fs *FileSystem) error { | ||
d.mutex.Lock() | ||
defer d.mutex.Unlock() | ||
|
||
// Read and parse the schema file | ||
bytes, err := ioutil.ReadFile(d.Path) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
d.Contents = string(bytes) | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -124,4 +124,4 @@ func parseFile(file *fs.File) error { | |
|
||
file.SyntaxTree = syntaxTree | ||
return nil | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
package utils | ||
|
||
const DdbtVersion = "0.5.0" | ||
const DdbtVersion = "0.5.1" |