-
-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'split-ferc2sqlite-ops' into pytest-with-f2s-ops
- Loading branch information
Showing
17 changed files
with
221 additions
and
244 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
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 |
---|---|---|
@@ -1,42 +1,17 @@ | ||
"""Hooks to integrate ferc to sqlite functionality into dagster graph.""" | ||
|
||
|
||
from dagster import Field, op | ||
|
||
import pudl | ||
from pudl.extract.ferc1 import Ferc1DbfExtractor | ||
from pudl.extract.ferc2 import Ferc2DbfExtractor | ||
from pudl.extract.ferc6 import Ferc6DbfExtractor | ||
from pudl.extract.ferc60 import Ferc60DbfExtractor | ||
from pudl.workspace.setup import PudlPaths | ||
|
||
logger = pudl.logging_helpers.get_logger(__name__) | ||
|
||
|
||
@op( | ||
config_schema={ | ||
"clobber": Field( | ||
bool, description="Clobber existing ferc1 database.", default_value=False | ||
), | ||
}, | ||
required_resource_keys={"ferc_to_sqlite_settings", "datastore"}, | ||
) | ||
def dbf2sqlite(context) -> None: | ||
"""Clone the FERC Form 1 Visual FoxPro databases into SQLite.""" | ||
# TODO(rousik): this thin wrapper seems to be somewhat quirky. Maybe there's a way | ||
# to make the integration # between the class and dagster better? Investigate. | ||
logger.info(f"dbf2sqlite settings: {context.resources.ferc_to_sqlite_settings}") | ||
|
||
extractors = [ | ||
Ferc1DbfExtractor, | ||
Ferc2DbfExtractor, | ||
Ferc6DbfExtractor, | ||
Ferc60DbfExtractor, | ||
] | ||
for xclass in extractors: | ||
xclass( | ||
datastore=context.resources.datastore, | ||
settings=context.resources.ferc_to_sqlite_settings, | ||
clobber=context.op_config["clobber"], | ||
output_path=PudlPaths().output_dir, | ||
).execute() | ||
ALL_DBF_EXTRACTORS = [ | ||
Ferc1DbfExtractor, | ||
Ferc2DbfExtractor, | ||
Ferc6DbfExtractor, | ||
Ferc60DbfExtractor, | ||
] |
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
Oops, something went wrong.