Code Monkey home page Code Monkey logo

Comments (8)

chfw avatar chfw commented on September 25, 2024

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

from django-excel.

maltitco avatar maltitco commented on September 25, 2024

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.

from django-excel.

chfw avatar chfw commented on September 25, 2024

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?

from django-excel.

maltitco avatar maltitco commented on September 25, 2024

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

from django-excel.

chfw avatar chfw commented on September 25, 2024

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

from django-excel.

chfw avatar chfw commented on September 25, 2024

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.

from django-excel.

maltitco avatar maltitco commented on September 25, 2024

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!

from django-excel.

chfw avatar chfw commented on September 25, 2024

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

from django-excel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.