forked from repo-mirrors/dbt-core
Compare commits
1 Commits
postgres-s
...
2021-06-30
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
38bb56d68b |
@@ -341,7 +341,7 @@ class PartialProject(RenderComponents):
|
||||
target_path: str = value_or(cfg.target_path, 'target')
|
||||
clean_targets: List[str] = value_or(cfg.clean_targets, [target_path])
|
||||
log_path: str = value_or(cfg.log_path, 'logs')
|
||||
modules_path: str = value_or(cfg.modules_path, 'dbt_modules')
|
||||
modules_path: str = value_or(cfg.modules_path, 'dbt_packages')
|
||||
# in the default case we'll populate this once we know the adapter type
|
||||
# It would be nice to just pass along a Quoting here, but that would
|
||||
# break many things
|
||||
|
||||
@@ -22,7 +22,7 @@ snapshot-paths: ["snapshots"]
|
||||
target-path: "target" # directory which will store compiled SQL files
|
||||
clean-targets: # directories to be removed by `dbt clean`
|
||||
- "target"
|
||||
- "dbt_modules"
|
||||
- "dbt_packages"
|
||||
|
||||
|
||||
# Configuring models
|
||||
|
||||
@@ -382,7 +382,7 @@ def _build_clean_subparser(subparsers, base_subparser):
|
||||
parents=[base_subparser],
|
||||
help='''
|
||||
Delete all folders in the clean-targets list
|
||||
(usually the dbt_modules and target directories.)
|
||||
(usually the dbt_packages and target directories.)
|
||||
'''
|
||||
)
|
||||
sub.set_defaults(cls=clean_task.CleanTask, which='clean', rpc_method=None)
|
||||
|
||||
@@ -16,7 +16,7 @@ require-dbt-version: '>=0.1.0'
|
||||
target-path: "target" # directory which will store compiled SQL files
|
||||
clean-targets: # directories to be removed by `dbt clean`
|
||||
- "target"
|
||||
- "dbt_modules"
|
||||
- "dbt_packages"
|
||||
|
||||
|
||||
seeds:
|
||||
|
||||
@@ -257,7 +257,7 @@ class TestSimpleDependencyDuplicateName(DBTIntegrationTest):
|
||||
|
||||
@use_profile('postgres')
|
||||
def test_postgres_local_dependency_same_name_sneaky(self):
|
||||
os.makedirs('dbt_modules')
|
||||
shutil.copytree('./duplicate_dependency', './dbt_modules/duplicate_dependency')
|
||||
os.makedirs('dbt_packages')
|
||||
shutil.copytree('./duplicate_dependency', './dbt_packages/duplicate_dependency')
|
||||
with self.assertRaises(dbt.exceptions.CompilationException):
|
||||
self.run_dbt(['compile'], expect_pass=False)
|
||||
|
||||
@@ -176,7 +176,7 @@ class TestRekeyedDependencyWithSubduplicates(DBTIntegrationTest):
|
||||
@use_profile('postgres')
|
||||
def test_postgres_simple_dependency_deps(self):
|
||||
self.run_dbt(["deps"])
|
||||
self.assertEqual(len(os.listdir('dbt_modules')), 2)
|
||||
self.assertEqual(len(os.listdir('dbt_packages')), 2)
|
||||
|
||||
|
||||
class TestSimpleDependencyBranch(DBTIntegrationTest):
|
||||
|
||||
@@ -16,7 +16,7 @@ require-dbt-version: '>=0.1.0'
|
||||
target-path: "target" # directory which will store compiled SQL files
|
||||
clean-targets: # directories to be removed by `dbt clean`
|
||||
- "target"
|
||||
- "dbt_modules"
|
||||
- "dbt_packages"
|
||||
|
||||
vars:
|
||||
first_dep:
|
||||
|
||||
@@ -16,7 +16,7 @@ require-dbt-version: '>=0.1.0'
|
||||
target-path: "target" # directory which will store compiled SQL files
|
||||
clean-targets: # directories to be removed by `dbt clean`
|
||||
- "target"
|
||||
- "dbt_modules"
|
||||
- "dbt_packages"
|
||||
|
||||
|
||||
seeds:
|
||||
|
||||
@@ -1120,12 +1120,12 @@ class TestRPCServerDeps(HasRPCServer):
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
if os.path.exists('./dbt_modules'):
|
||||
shutil.rmtree('./dbt_modules')
|
||||
if os.path.exists('./dbt_packages'):
|
||||
shutil.rmtree('./dbt_packages')
|
||||
|
||||
def tearDown(self):
|
||||
if os.path.exists('./dbt_modules'):
|
||||
shutil.rmtree('./dbt_modules')
|
||||
if os.path.exists('./dbt_packages'):
|
||||
shutil.rmtree('./dbt_packages')
|
||||
self.adapter.cleanup_connections()
|
||||
super().tearDown()
|
||||
|
||||
@@ -1143,7 +1143,7 @@ class TestRPCServerDeps(HasRPCServer):
|
||||
return "deps_models"
|
||||
|
||||
def _check_start_predeps(self):
|
||||
self.assertFalse(os.path.exists('./dbt_modules'))
|
||||
self.assertFalse(os.path.exists('./dbt_packages'))
|
||||
status = self.assertIsResult(self.query('status').json())
|
||||
# will return an error because defined dependency is missing
|
||||
self.assertEqual(status['state'], 'error')
|
||||
@@ -1154,8 +1154,8 @@ class TestRPCServerDeps(HasRPCServer):
|
||||
|
||||
self.wait_for_state('ready', timestamp=status['timestamp'])
|
||||
|
||||
self.assertTrue(os.path.exists('./dbt_modules'))
|
||||
self.assertEqual(len(os.listdir('./dbt_modules')), 1)
|
||||
self.assertTrue(os.path.exists('./dbt_packages'))
|
||||
self.assertEqual(len(os.listdir('./dbt_packages')), 1)
|
||||
self.assertIsResult(self.async_query('compile').json())
|
||||
|
||||
@mark.flaky(rerun_filter=addr_in_use, max_runs=3)
|
||||
|
||||
@@ -626,7 +626,7 @@ class TestProject(BaseConfigTest):
|
||||
self.assertEqual(project.target_path, 'target')
|
||||
self.assertEqual(project.clean_targets, ['target'])
|
||||
self.assertEqual(project.log_path, 'logs')
|
||||
self.assertEqual(project.modules_path, 'dbt_modules')
|
||||
self.assertEqual(project.modules_path, 'dbt_packages')
|
||||
self.assertEqual(project.quoting, {})
|
||||
self.assertEqual(project.models, {})
|
||||
self.assertEqual(project.on_run_start, [])
|
||||
@@ -673,7 +673,7 @@ class TestProject(BaseConfigTest):
|
||||
'target-path': 'other-target',
|
||||
'clean-targets': ['another-target'],
|
||||
'log-path': 'other-logs',
|
||||
'modules-path': 'other-dbt_modules',
|
||||
'modules-path': 'other-dbt_packages',
|
||||
'quoting': {'identifier': False},
|
||||
'models': {
|
||||
'pre-hook': ['{{ logging.log_model_start_event() }}'],
|
||||
@@ -743,7 +743,7 @@ class TestProject(BaseConfigTest):
|
||||
self.assertEqual(project.target_path, 'other-target')
|
||||
self.assertEqual(project.clean_targets, ['another-target'])
|
||||
self.assertEqual(project.log_path, 'other-logs')
|
||||
self.assertEqual(project.modules_path, 'other-dbt_modules')
|
||||
self.assertEqual(project.modules_path, 'other-dbt_packages')
|
||||
self.assertEqual(project.quoting, {'identifier': False})
|
||||
self.assertEqual(project.models, {
|
||||
'pre-hook': ['{{ logging.log_model_start_event() }}'],
|
||||
@@ -1238,7 +1238,7 @@ class TestRuntimeConfigFiles(BaseFileTest):
|
||||
self.assertEqual(config.target_path, 'target')
|
||||
self.assertEqual(config.clean_targets, ['target'])
|
||||
self.assertEqual(config.log_path, 'logs')
|
||||
self.assertEqual(config.modules_path, 'dbt_modules')
|
||||
self.assertEqual(config.modules_path, 'dbt_packages')
|
||||
self.assertEqual(config.quoting, {'database': True, 'identifier': True, 'schema': True})
|
||||
self.assertEqual(config.models, {})
|
||||
self.assertEqual(config.on_run_start, [])
|
||||
|
||||
@@ -60,7 +60,7 @@ class BaseParserTest(unittest.TestCase):
|
||||
unique_id=f'macro.root.{name}',
|
||||
package_name='root',
|
||||
original_file_path=normalize('macros/macro.sql'),
|
||||
root_path=get_abs_os_path('./dbt_modules/root'),
|
||||
root_path=get_abs_os_path('./dbt_packages/root'),
|
||||
path=normalize('macros/macro.sql'),
|
||||
macro_sql=sql,
|
||||
)
|
||||
@@ -106,7 +106,7 @@ class BaseParserTest(unittest.TestCase):
|
||||
'name': 'snowplow',
|
||||
'version': '0.1',
|
||||
'profile': 'test',
|
||||
'project-root': get_abs_os_path('./dbt_modules/snowplow'),
|
||||
'project-root': get_abs_os_path('./dbt_packages/snowplow'),
|
||||
'config-version': 2,
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ class BaseParserTest(unittest.TestCase):
|
||||
self.patcher.stop()
|
||||
|
||||
def file_block_for(self, data: str, filename: str, searched: str):
|
||||
root_dir = get_abs_os_path('./dbt_modules/snowplow')
|
||||
root_dir = get_abs_os_path('./dbt_packages/snowplow')
|
||||
filename = normalize(filename)
|
||||
path = FilePath(
|
||||
searched_path=searched,
|
||||
@@ -499,7 +499,7 @@ class ModelParserTest(BaseParserTest):
|
||||
fqn=['snowplow', 'nested', 'model_1'],
|
||||
package_name='snowplow',
|
||||
original_file_path=normalize('models/nested/model_1.sql'),
|
||||
root_path=get_abs_os_path('./dbt_modules/snowplow'),
|
||||
root_path=get_abs_os_path('./dbt_packages/snowplow'),
|
||||
config=NodeConfig(materialized='table'),
|
||||
path=normalize('nested/model_1.sql'),
|
||||
raw_sql=raw_sql,
|
||||
@@ -560,7 +560,7 @@ class SnapshotParserTest(BaseParserTest):
|
||||
fqn=['snowplow', 'nested', 'snap_1', 'foo'],
|
||||
package_name='snowplow',
|
||||
original_file_path=normalize('snapshots/nested/snap_1.sql'),
|
||||
root_path=get_abs_os_path('./dbt_modules/snowplow'),
|
||||
root_path=get_abs_os_path('./dbt_packages/snowplow'),
|
||||
config=SnapshotConfig(
|
||||
strategy='timestamp',
|
||||
updated_at='last_update',
|
||||
@@ -621,7 +621,7 @@ class SnapshotParserTest(BaseParserTest):
|
||||
fqn=['snowplow', 'nested', 'snap_1', 'foo'],
|
||||
package_name='snowplow',
|
||||
original_file_path=normalize('snapshots/nested/snap_1.sql'),
|
||||
root_path=get_abs_os_path('./dbt_modules/snowplow'),
|
||||
root_path=get_abs_os_path('./dbt_packages/snowplow'),
|
||||
config=SnapshotConfig(
|
||||
strategy='timestamp',
|
||||
updated_at='last_update',
|
||||
@@ -651,7 +651,7 @@ class SnapshotParserTest(BaseParserTest):
|
||||
fqn=['snowplow', 'nested', 'snap_1', 'bar'],
|
||||
package_name='snowplow',
|
||||
original_file_path=normalize('snapshots/nested/snap_1.sql'),
|
||||
root_path=get_abs_os_path('./dbt_modules/snowplow'),
|
||||
root_path=get_abs_os_path('./dbt_packages/snowplow'),
|
||||
config=SnapshotConfig(
|
||||
strategy='timestamp',
|
||||
updated_at='last_update',
|
||||
@@ -703,7 +703,7 @@ class MacroParserTest(BaseParserTest):
|
||||
unique_id='macro.snowplow.foo',
|
||||
package_name='snowplow',
|
||||
original_file_path=normalize('macros/macro.sql'),
|
||||
root_path=get_abs_os_path('./dbt_modules/snowplow'),
|
||||
root_path=get_abs_os_path('./dbt_packages/snowplow'),
|
||||
path=normalize('macros/macro.sql'),
|
||||
macro_sql=raw_sql,
|
||||
)
|
||||
@@ -726,7 +726,7 @@ class MacroParserTest(BaseParserTest):
|
||||
unique_id='macro.snowplow.bar',
|
||||
package_name='snowplow',
|
||||
original_file_path=normalize('macros/macro.sql'),
|
||||
root_path=get_abs_os_path('./dbt_modules/snowplow'),
|
||||
root_path=get_abs_os_path('./dbt_packages/snowplow'),
|
||||
path=normalize('macros/macro.sql'),
|
||||
macro_sql='{% macro bar(c, d) %}c + d{% endmacro %}',
|
||||
)
|
||||
@@ -736,7 +736,7 @@ class MacroParserTest(BaseParserTest):
|
||||
unique_id='macro.snowplow.foo',
|
||||
package_name='snowplow',
|
||||
original_file_path=normalize('macros/macro.sql'),
|
||||
root_path=get_abs_os_path('./dbt_modules/snowplow'),
|
||||
root_path=get_abs_os_path('./dbt_packages/snowplow'),
|
||||
path=normalize('macros/macro.sql'),
|
||||
macro_sql='{% macro foo(a, b) %}a ~ b{% endmacro %}',
|
||||
)
|
||||
@@ -779,7 +779,7 @@ class DataTestParserTest(BaseParserTest):
|
||||
fqn=['snowplow', 'data_test', 'test_1'],
|
||||
package_name='snowplow',
|
||||
original_file_path=normalize('tests/test_1.sql'),
|
||||
root_path=get_abs_os_path('./dbt_modules/snowplow'),
|
||||
root_path=get_abs_os_path('./dbt_packages/snowplow'),
|
||||
refs=[['blah']],
|
||||
config=TestConfig(severity='ERROR'),
|
||||
tags=['data'],
|
||||
@@ -823,7 +823,7 @@ class AnalysisParserTest(BaseParserTest):
|
||||
fqn=['snowplow', 'analysis', 'nested', 'analysis_1'],
|
||||
package_name='snowplow',
|
||||
original_file_path=normalize('analyses/nested/analysis_1.sql'),
|
||||
root_path=get_abs_os_path('./dbt_modules/snowplow'),
|
||||
root_path=get_abs_os_path('./dbt_packages/snowplow'),
|
||||
depends_on=DependsOn(),
|
||||
config=NodeConfig(),
|
||||
path=normalize('analysis/nested/analysis_1.sql'),
|
||||
|
||||
@@ -235,7 +235,7 @@ def generate_name_macros(package):
|
||||
unique_id=f'macro.{package}.{name}',
|
||||
package_name=package,
|
||||
original_file_path=normalize('macros/macro.sql'),
|
||||
root_path='./dbt_modules/root',
|
||||
root_path='./dbt_packages/root',
|
||||
path=normalize('macros/macro.sql'),
|
||||
macro_sql=sql,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user