Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend layout placeholder params for filesystem destinations (#1182)
* Introduce new config fields to filesystem destination configuration * Merge layout.py with path_utils.py * Adjust tests * Fix linting issues and extract common types * Use pendulum.now if current_datetime is not defined * Add more layout tests * Fix failing tests * Cleanup tests * Adjust tests * Enable auto_mkdir for local filesystem * Format code * Extract re-usable functions and fix test * Add invalid layout * Accept load_package timestamp in create_path * Collect all files and directories and then delete files first then directories * Recursively descend and collect files and directories to truncate for filesystem destination * Mock load_package timestamp and add more test layouts * Fix linting issues * Use better variable name to avoid shadowing builtin name * Fix dummy tests * Revert changes to filesystem impl * Use timestamp if it is specified * Cleanup path_utils and remove redundant code * Revert factory * Refactor path_utils and simplify things * Remove custom datetime format parameter * Pass load_package_timestamp * Remove custom datetime format and current_datetime parameter parameter * Cleanup imports * Fix path_utils tests * Make load_package_timestamp optional * Revert some changes in tests * Uncomment layout test item * Revert fs client argument changes * Fix mypy issue * Fix linting issues * Use all aggregated placeholder when checking layout * Enable auto_mkdir for filesystem config tests * Enable auto_mkdir for filesystem config tests * Enable auto_mkdir only for local filesystem * Add more placeholders * Remove extra layout options * Accepts current_datetime * Adjust type names * Pass current datetime * Resolve current_datetime if it is callable * Fix linting issues * Parametrize layout check test * Fix mypy issues * Fix mypy issues * Add more tests * Add more test checks for create_path flow * Add test flow comment * Add more tests * Add test to check callable extra placeholders * Test if unused layout placeholders are printed * Adjust timestamp selection logic * Fix linting issues * Extend default placeholders and remove redundant ones * Add quarter placeholder * Add test case for layout with quarter of the year * Adjust type alias for placeholder callback * Simplify code * Adjust tests * Validate placeholders in on_resolve * Avoid assigning current_datetime callback value during validation * Fix mypy warnings * Fix linting issues * Log warning message with yellow foreground * Remove useless test * Adjust error message for placeholder callback functions * Lowercase formatted datetime values * Adjust comments * Re-import load_storage * Adjust logic around timestamp and current datetime * Fix mypy warnings * Add test configuraion override when values passed via filesystem factory * Better logic to handle current timestamp and current datetime * Add more test checks * Introduce new InvalidPlaceholderCallback exception * Raise InvalidPlaceholderCallback instead of plain TypeError * Fix import ban error * Add more test cases for path utils layout check * Adjust text color * Small cleanup * Verify path parts and layout parts are equal * Remove unnecessary log * Add test with actual pipeline run and checks for callback calls * Revert conftest changes * Cleanup and move current_datetime calling inside path_utils * Adjust test * Add clarification comment * Use logger instead of printing out * Make InvalidPlaceholderCallback of transient kind * Move tests to new place * Cleanup * Add load_package_timestamp placeholder * Fix mypy warning * Add pytest-mock * Adjust tests * Adjust logic * Fix mypy issue * Use spy on logger for a test * Add test layout example with load_package_timestamp * Add test layout example with load_package_timestamp in pipeline tests * Check created paths and assert validity of placeholders * Rename variable to better fit the context * Assert arguments in extra placeholder callbacks * Make invalid placeholders exception more useful * Assert created path with spy values * Make error messages better for InvalidFilesystemLayout exception * Fix mypy errors * Also check created path * Run pipeline then create path and check if files exist * Fix mypy errors * Check all load packages * Add more layout samples using custom placeholders * Add more layout samples with callable extra placeholder * Add more layout samples with callable extra placeholder * Remove redundant import * Check expected paths created by create_path * Fix mypy issues * Add explanation comment to ALL_LAYOUTS * Re-use frozen datetime * Use dlt.common.pendulum * Use ensure_pendulum_datetime instead of pendulum.parse * Fix mypy issues * Add invalid layout with extra placeholder before table_name * Adjust exception message from invalid to missing placeholders
- Loading branch information