-
Notifications
You must be signed in to change notification settings - Fork 4
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
Retire SupportsMoveFromTempLocAfterFillingIt from DataUrlTarget #115
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 |
---|---|---|
@@ -1 +1 @@ | ||
93.5700 | ||
93.5600 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
92.3400 | ||
92.3300 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
from ..results import MoveResult | ||
from ..records_directory import RecordsDirectory | ||
from .base import (SupportsMoveFromDataframes, | ||
SupportsMoveFromTempLocAfterFillingIt, | ||
SupportsMoveToRecordsDirectory, | ||
SupportsMoveFromRecordsDirectory) | ||
from ..processing_instructions import ProcessingInstructions | ||
from ...url.base import BaseFileUrl | ||
|
@@ -16,7 +14,6 @@ | |
|
||
|
||
class DataUrlTarget(SupportsMoveFromDataframes, | ||
SupportsMoveFromTempLocAfterFillingIt, | ||
SupportsMoveFromRecordsDirectory): | ||
def __init__(self, | ||
output_loc: BaseFileUrl, | ||
|
@@ -63,25 +60,6 @@ def move_from_records_directory(self, | |
records_format.generate_filename('data'): self.output_loc.url | ||
}) | ||
|
||
def move_from_temp_loc_after_filling_it(self, | ||
records_source: | ||
SupportsMoveToRecordsDirectory, | ||
processing_instructions: | ||
ProcessingInstructions) -> MoveResult: | ||
pis = processing_instructions | ||
records_format = records_source.compatible_format(self) | ||
if records_format is None: | ||
raise NotImplementedError("No compatible records format between " | ||
f"{records_source} and {self}") | ||
with self.output_loc.temporary_directory() as temp_loc: | ||
directory = RecordsDirectory(records_loc=temp_loc) | ||
records_source.\ | ||
move_to_records_directory(directory, | ||
records_format=records_format, | ||
processing_instructions=pis) | ||
return self.move_from_records_directory(directory, | ||
processing_instructions) | ||
|
||
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. This function said "Move something to this filesystem by first creating a temporary directory ON THIS SAME FILESYSTEM and then copying from there". Kind of silly, since you can also just copy directly to the intended destination (see the The purpose of I'm guessing this function in this file was implemented at some point of time in the past in order to work around some wart or another in the There's been a lot of incremental development and refactoring among all of these things, and evolutionary dead-ends are not unknown :) |
||
def can_move_from_this_format(self, | ||
source_records_format: BaseRecordsFormat) -> bool: | ||
if self.records_format is None: | ||
|
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.
Targets in Records Mover represent the second part in a move (e.g., in a Redshift to S3 copy, S3 is the target and Redshift is the source).
DataUrlTarget represents any kind of filesystem-like thing - currently it works with
file://
,gs://
ands3://
URLs, but will probably getsftp://
support at some point as well.