jtiai: does pickling the .query actually achieve much in terms of performance?
jtiai
Depends where session is saved.
N3TC4T
Hey guys , how can I change django csrfmiddleware field name ?
jtiai
In our case it was in db, and one query had over 2M objects causing constant copying over 30MB of data...
hylje
welp
kezabelle
jtiai: :o
NomadJim has quit
jtiai
Big object with big geometry data.
hylje
for you
kingplusplus
i have a file about 500mb and each line has a website and i want check the status of each site and save the output of site the responds with 200k which method is better should i loop through each line using the “with open()…” or just do a normal “open()” and store the content of the file to a variable
and loop through it? One would be more memory intensive and slower I suppose… please which is better?
hylje
if you don't run many processes doing it in parallel you can get away with reading the entire file to memory
NomadJim joined the channel
reading it line by line is probably more considerate
lorddaedra joined the channel
kezabelle
with open() is just a convenience for remembering to close the file.
hylje
i'm pretty sure file objects provide a convenience method for iterating over every line in the file
kezabelle
yeah
domino14 joined the channel
domino14
using the database backend for caching and now my tests fail because the cache table doesnt exist
how do i make the ./manage.py test create the cache table?
pombreda
kingplusplus: how is this related to #django? may be you should try on #python
jtiai
kezabelle: That's why we used query pickling since query itself is relatively simple (filtering by few fields), it's just number of objects it returns is huge.
hylje
domino14: a migration needs to create it
jtiai
domino14: Or, don't use database as cache in testing.
hylje
the only table not migrated into existence is the migrations lookup table itself
domino14
./manage.py createcachetable doesnt create a mgiration
shangxiao
pombreda, kingplusplus: all sorts of questions are happily answered in here
kezabelle
hylje: thats not true, because the db cache exists in a weird way, historically, IIRC
domino14
why wouldnt that be automatic
pombreda
shangxiao: sure, that one sounds a tad off topic :P
hylje
because tests only automatically run migrations and not any other magic
shangxiao
pombreda: perhaps, although if it's for django project…
adsworth joined the channel
kingplusplus: but yeah if nobody is able to help here, #python is usually active too
bullicon joined the channel
eperzhand has quit
pombreda
shangxiao: if I read kingplusplus question well, just loop through the lines with for line in .... ; how the file was opened does not matter to memory usage. How it is read does.
lorddaedra has quit
tulioz has quit
kezabelle
I mean, unless you're parallelising the task, iterating over 500MB of URLs and doing a HEAD for 200 is probably whats going to take the time, anyway
linski joined the channel
linski
Is google spreadsheets a nosql db?
I want to replace postgres with google spreadsheets
pombreda
linski: hum. Are you serious?
Y04NN joined the channel
adsworth has quit
kezabelle
lol
shangxiao
funnily enough
whaack joined the channel
there was a project that turned google spreadsheets into an orm
kezabelle
there's a few
hylje
to be fair google spreadsheets is a web scale managed database
lorddaedra joined the channel
shangxiao
linski: if anything spreadsheets are like a dirty relational database
N3TC4T has quit
pombreda
I am sure this can be done. the question is short of a very specific use case and purpose: should is be done? :D
hylje
no
shangxiao
lol
kezabelle
I remember years ago encountering a PHP site that used Google Spreadsheets as a cached CMS
these days it seems popular again, and with node.
shangxiao
it _might_ be if you want to do some automated importing from that as a data source or something
hylje
google spreadsheets seems like a valid backend for a glorified static site generator
shangxiao
xD
hylje
all that matters is your normie content managers can use it
linski
times are tough here
kezabelle
hylje: it does, but I can't see how it'd be a good way of managing large chunks of content
shangxiao
times will be tougher if you replace postgres with spreadsheets xD
pombreda
so Google sheet can be seen a multi-user, cloud-based, scalable, schema-less database.The same way emacs does the same, but eschewing the complexity of storing things in rows/columns together and for single users only
kezabelle
I mean ... the cells are tiny. they'd need to be at least 3 times bigger
hylje
you can build a form to update/add/edit your spreadsheet data
kezabelle
oh can you?
pombreda
yep
whaack has quit
kezabelle
TIL.
hylje
yeah some people use a public gspread form to do polls and questionnaires
kezabelle
yeah I've seen them, but never clicked on them ;)
lorddaedra has quit
Tomatosoup- joined the channel
shangxiao
heh
eperzhand joined the channel
PickAndMix
hey FunkyBob I was reading up on the GCBV earlier, I think UpdateView might not be the way to go as I want to 'create' notes and not 'update' tehm
After googling and stuffs, I saw a post where someone said it's possible to use detailview and add a form in the context (which is my current status) and point it towards a seperate formview
encod3 joined the channel
hamub has quit
rufus joined the channel
pombreda
linski: so I guess the comments here provide some hints: this is not a nosql DB, but a spreadsheet tool that can store rows and columns in a limited way. This hardly can be seen as a replacement for Postgres. The same way a hoverboard shares some properties with a car, it cannot replace a car. And I do not know of any backend for Django to use that.
domino14 has quit
lorddaedra joined the channel
shangxiao
FunkyBob has something to say about the label 'nosql'
pombreda
:D
linski
Thanks for help :)
jtiai
ArangoDB is pretty neat for no-sql data... :)
finmaster19 joined the channel
pombreda
you meant: no? sql!
jtiai
Actually arangodb query language is more sql than sql itself.. ;)
lorddaedra has quit
shangxiao
i hear that a lot
i must try it
jtiai
It's pretty neat. We use arangodb to store some documents, mainly checklist types.
rufus
hi, I have lots of doubts and fears when editing model fields and running migrations having had lots of problems with it.. Can anyone tell me what is a safe way to modify a decimalfield previously set with null= True, deleting this option? I tried, ran makemigrations and returned error..
jtiai
rufus: So what's the error..?
kezabelle
probably there was null data? ;)
PickAndMix
hey guys, http://dpaste.com/0DB06BQ This is my current detailview. I'm trying to accomplish having a form to save NEW 'snippets/notes' in the same page as the details page. Right now the form is appearing as I saved it in the context, but it's not saving when I click submit
anyone can give a hand?
pombreda
rufus: can you use dpaste.de for details?
rufus
kezabelle: yes there were some
kezabelle
rufus: well then you'd need to fix that before you could migrate
PickAndMix
my code is kinda from the docs.
kezabelle
usually with a data migration
rufus
jtiai: many errors, last line shows: unable to ALTER TABLE as there are pending trigger events
PickAndMix
I'm guessing it's because I didn't have some kinda obj.save?
rufus
kezabelle: yes how to fix this? I had options and chose to have manually filled the null values..
jtiai
PickAndMix: ... now I know why I never dare to wander to land of GCBVs... :)
kezabelle
jtiai: heh
PickAndMix
jtiai: T.T
and a first-timer like me wanders in cluelessly
jtiai
That's why I like FBVs, it's much harder to get lost.
PickAndMix
jtiai: are you able to achieve all these with FBV?
keimlink joined the channel
jtiai: a detail view and a create view together?
I'll probably give that a try on another app.
jtiai
I can do whatever I want to since it would be full control for me.
Of course I've used plain CBVs rather successfully, it's just generics that gives me a big creeps.
PickAndMix
T.T
FinalAngel joined the channel
jtiai: haha
jtiai: I guess if FBV are working great for you, there's no reason to change
jtiai: I think I'm getting the result I want, right now I just need to find a way to link up the "task.id" to my notes model.
lol I'm so bad at django
blackcross has quit
pombreda
rufus: seeing Python exceptions stack traces in Italian is a first for me :P
rufus
pombreda: yeah last line means: unable to ALTER TABLE as there are pending trigger events
DodgeThis has quit
bullicon has quit
sebastian-w
hi all. just a quick question: I'm about to add a bunch of models to an application with multiple django apps. The UI will be closely related to an existing app, but the functionalliity will be a different one. When shoud I create a new django app?
Juzzika joined the channel
Lauxley joined the channel
jtiai
sebastian-w: Good rule of thumb: app does one thing, and one thing only - and does it well.
sebastian-w
jtiai: thanks!
rufus
kezabelle: could I just delete fields (database is still on test) migrate and then rebuild the new model with fields deleting Null = True? Will this work?
jtiai
rufus: Depends do you have to update production database(s) that may have nulls.
pombreda
rufus: this is a DB locking issue. Have you tried to stop and restart your DB server?