Repository navigation
autogenerate indices using parallel loader - #228
Conversation
| def __init__(self, filename, df=None, use_dask=False): | ||
|
|
||
| super().__init__(filename, df=df, use_dask=use_dask) | ||
| if not use_dask: |
There was a problem hiding this comment.
This check ensures that a CSV file is not read at the first pass when dask mode is used. It's a performance optimization, but it's impact can be observed when using a file with millions of rows. I can explain more offline.
There was a problem hiding this comment.
Thanks, sorry, forgot to hit send 🤦
My interpretation was that this was only making use of the header, which should already be populated by super().__init__() and validation().
In any event, for this PT, I only need the header row. Is there a way to get that without having to read the whole file?
There was a problem hiding this comment.
I see. I think we can merge it and worry about the optimization part later.
| super().__init__(db, dry_run=dry_run) | ||
| self.type = "element" | ||
|
|
||
| def get_existing_indices(self): |
There was a problem hiding this comment.
sorry to join the party late here 🥲
This functionality is pretty much a re-implementation of what we have on our Utils.py file. We should try to re-use those.
There was a problem hiding this comment.
I will create an issue for re-factoring this later, it is not a big deal.
|
|
||
| create_indices = [{"CreateIndex": idx} for idx in new_indices] | ||
|
|
||
| res, _ = self.db.query( |
There was a problem hiding this comment.
same here, we should just use this method on Utils.py.
When using data loaders, it will attempt to create an index for any property we use for conditional add (ie. with
constraint_prefix), if it is not already indexed.Fixes #136