コード例 #1
0
 def _build_file(self, contents, relative_path) -> FileBlock:
     match = FilePath(
         relative_path=relative_path,
         project_root=self.root_path,
         searched_path=self.subdir_path,
     )
     source_file = SourceFile(path=match, checksum=FileHash.empty())
     source_file.contents = contents
     return FileBlock(file=source_file)
コード例 #2
0
 def use_models(self, models):
     for k, v in models.items():
         path = FilePath(
             searched_path='models',
             project_root=os.path.normcase(os.getcwd()),
             relative_path='{}.sql'.format(k),
         )
         source_file = SourceFile(path=path, checksum=FileHash.empty())
         source_file.contents = v
         self.mock_models.append(source_file)
コード例 #3
0
ファイル: test_parser.py プロジェクト: convoyinc/dbt
 def file_block_for(self, data: str, filename: str, searched: str):
     root_dir = get_abs_os_path('./dbt_modules/snowplow')
     filename = normalize(filename)
     path = FilePath(
         searched_path=searched,
         relative_path=filename,
         project_root=root_dir,
     )
     source_file = SourceFile(
         path=path,
         checksum=FileHash.from_contents(data),
     )
     source_file.contents = data
     return FileBlock(file=source_file)
コード例 #4
0
ファイル: test_parse_manifest.py プロジェクト: convoyinc/dbt
 def _new_file(self, searched, name, match):
     if match:
         checksum = MatchingHash()
     else:
         checksum = MismatchedHash()
     path = FilePath(
         searched_path=normalize(searched),
         relative_path=normalize(name),
         project_root=normalize(self.root_project_config.project_root),
     )
     return SourceFile(path=path, checksum=checksum)
コード例 #5
0
 def load_file(self, match: FilePath) -> SourceFile:
     return SourceFile.seed(match)
コード例 #6
0
 def parse_remote(self, sql: str, name: str) -> ParsedRPCNode:
     source_file = SourceFile.remote(contents=sql)
     contents = RPCBlock(rpc_name=name, file=source_file)
     return self.parse_node(contents)
コード例 #7
0
ファイル: base.py プロジェクト: convoyinc/dbt
 def load_file(self, path: FilePath) -> SourceFile:
     file_contents = load_file_contents(path.absolute_path, strip=False)
     checksum = FileHash.from_contents(file_contents)
     source_file = SourceFile(path=path, checksum=checksum)
     source_file.contents = file_contents.strip()
     return source_file