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

Import empty rows #2

Closed
maltitco opened this Issue Jun 2, 2015 · 8 comments

Comments

Projects
None yet
2 participants
@maltitco
Copy link

maltitco commented Jun 2, 2015

Why is it possible to import empty rows?
zrzut ekranu 2015-06-02 o 14 35 52

zrzut ekranu 2015-06-02 o 14 32 30

They should not be skipped?

@chfw

This comment has been minimized.

Copy link
Member

chfw commented Jun 2, 2015

I have applied the fix there in pyexcel-io: pyexcel/pyexcel-io#1

You can get it before I release it via:

 pip install git+https://github.com/chfw/pyexcel-io.git

Please let me know if it works for you

@maltitco

This comment has been minimized.

Copy link
Author

maltitco commented Jun 3, 2015

Hey, that works fine, but only in a situation where the model does not have fields with the value "unique = True".

I tested a situation when the database is already one of the fields blank with the parameter "unique=True"

duplicate key value violates unique constraint "expenses_expensestype_expenses_type_key"
DETAIL:  Key (expenses_type)=() already exists.

Therefore, I think a good solution would be to introduce a parameter that allowed to skip the already existing values.

@chfw

This comment has been minimized.

Copy link
Member

chfw commented Jun 3, 2015

By default, pyexcel give '' for empty cell but I think database treat null as empty. In your case, I guess it is because '' was given toexpenses_type and if '' is given at the second time, it will hit unique key problem. So, I suppose if pyexcel replace '' for None in your case, would it help?

@maltitco

This comment has been minimized.

Copy link
Author

maltitco commented Jun 3, 2015

This would help only if the blank and duplicate were changed to None. This would eliminate the problem of unique.

@chfw

This comment has been minimized.

Copy link
Member

chfw commented Jun 4, 2015

tried, 'None' field does not work for Django. I have another solution and am working on it. Here is the issue tracker for it. pyexcel/pyexcel-io#2

@chfw

This comment has been minimized.

Copy link
Member

chfw commented Jun 4, 2015

Please try the newer fix again:

 pip install git+https://github.com/chfw/pyexcel-io.git

Hope it make your use case smooth.

I have to say it will be slow if your data size is huge but for now, I couldn't think of other faster way.

@maltitco

This comment has been minimized.

Copy link
Author

maltitco commented Jun 8, 2015

Hello, I tested and working properly. In the case where the model have a unique value duplicate and blank lines are ignored. In the case of large amounts of data can be divided and import parcels.

Thank you very much!

@chfw

This comment has been minimized.

Copy link
Member

chfw commented Jun 11, 2015

pyexcel-io v0.0.5 with two fixes was just published to pypi.

@chfw chfw closed this Jun 11, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment