Skip to content
This repository was archived by the owner on Aug 25, 2024. It is now read-only.

source: csv: Add config to load data from filename #279

Closed
johnandersen777 opened this issue Dec 31, 2019 · 3 comments
Closed

source: csv: Add config to load data from filename #279

johnandersen777 opened this issue Dec 31, 2019 · 3 comments
Labels
enhancement New feature or request p2 Medium Priority tS Esitmated Time To Complete: Short

Comments

@johnandersen777
Copy link

johnandersen777 commented Dec 31, 2019

@config
class CSVSourceConfig(FileSourceConfig):
key: str = CSV_SOURCE_CONFIG_DEFAULT_KEY
label: str = CSV_SOURCE_CONFIG_DEFAULT_LABEL
labelcol: str = CSV_SOURCE_CONFIG_DEFAULT_LABEL_COLUMN

Add a config option which is a list of strings, which are the column names which should have their data replaced with the contents of the file for which they had the filename of as their value initially.

dffml/dffml/source/csv.py

Lines 192 to 194 in c0899bc

# Write the features
for key, value in repo_data.get("features", {}).items():
row[key] = value

If key (column name) is in the new config (files or something) then do

row[key] = pathlib.Path(value).read_bytes()

Make sure there is a testcase for it.

@johnandersen777 johnandersen777 added the enhancement New feature or request label Dec 31, 2019
@johnandersen777 johnandersen777 added this to the 0.3.3 Alpha Release milestone Jan 3, 2020
@johnandersen777 johnandersen777 added p2 Medium Priority tS Esitmated Time To Complete: Short labels Jan 5, 2020
@johnandersen777
Copy link
Author

@sakshamarora1 is working on this as a part of #272

@sakshamarora1
Copy link
Contributor

@pdxjohnny this issue has been solved by #399 ?

@johnandersen777
Copy link
Author

johnandersen777 commented Mar 28, 2020

It has been solve by that indeed! Thank you @sakshamarora1!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request p2 Medium Priority tS Esitmated Time To Complete: Short
Projects
None yet
Development

No branches or pull requests

2 participants