calgo-lab / green-db

The monorepo that powers the GreenDB.
https://calgo-lab.github.io/green-db/
22 stars 2 forks source link

automatic mapping of table names to extractors #41

Closed en-GB closed 2 years ago

en-GB commented 2 years ago

removes some manual steps to adding new shops

en-GB commented 2 years ago

Is it possible to "find" these functions (I think it's also fine to expect that this function exists), e.g., extract_otto in the file otto dynamically and directly return the mapping instead of return the names?

yes. i wasnt comfortable with having magic names like that. i could use a decorator maybe

se-jaeger commented 2 years ago

I pushed a suggestions. It does not need any indirections or decorators and has much fewer lines of code. It just relies on file names, e.g., otto.py or zalando.py used as table names and they need to expose the function extract (no suffix). WDYT?

en-GB commented 2 years ago

by indirection you mean the import * in extractors/__init__.py? i still feel like thats better than using import_module

en-GB commented 2 years ago

closed as discussed