Comments (6)
Array fields are cast to python lists. http://docs.python.org/2/tutorial/datastructures.html#more-on-lists
Should work, but haven't tested it: instance.array_prop.remove('some-element')
Remember to call instance.save()
from djorm-pgarray.
actually, you might need to do something more like this
arr = instance.array_prop
arr.remove('some-element')
instance.array_prop = arr
instance.save()
from djorm-pgarray.
The issue with the above approach is that editing large arrays becomes very expensive. Modifying an ArrayField with 500,000 elements takes over a second. I was wondering more on the lines if array_append/array_remove/array_replace(http://www.postgresql.org/docs/9.3/static/functions-array.html) etc were available instead.
from djorm-pgarray.
There's an array that has half a million records in your DB? I'd be curious to know what kind of application needs that kind of scale.
Anyways, I don't think there's anything like this "baked in."
You might take a look at django.db.models.compiler.SQLUpdateCompiler
from djorm-pgarray.
For now, you might just have to execute the SQL directly: https://docs.djangoproject.com/en/1.6/topics/db/sql/#executing-custom-sql-directly
from djorm-pgarray.
Figured as much, using raw sql atm.
As for the scale, there are dispatch numbers assigned to a coloader sitting in an arrayfield. Consumption of such a number across any of the few thousand coloading centers is a continous process, at which point it is promptly removed from the arrayfield.
Also thanks for the tip on django.db.models.compiler.SQLUpdateCompiler Will try to see if I can get a patch in.
from djorm-pgarray.
Related Issues (20)
- Unicode values and `ArrayFormField` HOT 4
- ArrayField(dbtype='date') HOT 3
- Table creation in Django 1.7 HOT 1
- Default null and blank kwargs are inconsistent with default null and blank kwargs for Django fields HOT 2
- Multiple DB representations for blank values HOT 1
- dbtype / type_cast are not Django-esque HOT 2
- ArrayFormField with dimension > 1 HOT 1
- How to use PostgreSQL array operator in Django 1.6? HOT 2
- Bug with the default form field HOT 5
- TLDR: where's PyPI release? HOT 1
- How work with pgarray? HOT 2
- Model class is read multiple times, but pop removes the dbtype argument HOT 8
- Django Admin HOT 1
- Incorect work with migrations in Django 1.7 HOT 6
- How to properly delete an object that uses pg_array fields HOT 2
- Tag version 1.2 in git HOT 2
- Migrating to 1.8's django.contrib.postgres.fields.ArrayField HOT 3
- Use GIN index by default
- django.db.utils.ProgrammingError: operator class "text_pattern_ops" does not accept data type text[]
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from djorm-pgarray.