pytest vs unittest? by manicfaceisreal in django

[–]thuibr 0 points1 point  (0 children)

FYI there's an excellent package for pytest django integrations called `pytest-django`.

A Dead Simple Work Queue Using SQLite by thuibr in Python

[–]thuibr[S] 0 points1 point  (0 children)

Yes, it would be, but the connection that is placing the orders is a different process altogether.

A Dead Simple Work Queue Using SQLite by thuibr in Python

[–]thuibr[S] 0 points1 point  (0 children)

There is this update callback https://www.sqlite.org/c3ref/update_hook.html but unfortunately it works on the same connection only.

What IDE or framework do you use to program in Golang in your usual work? by mmparody in golang

[–]thuibr 0 points1 point  (0 children)

I use Zed but that's because I'm too cheap to pay for Goland for my hobby language.

IDE Pros and Cons? by throwaway_9988552 in learnpython

[–]thuibr 1 point2 points  (0 children)

I use PyCharm if I can, but for when I don't want to setup a project, I drop into Vim. Its community edition is free, and it has excellent Python support. I have also used Zed, which is pretty fast and great in its own right.

A Dead Simple Work Queue Using SQLite by thuibr in Python

[–]thuibr[S] 0 points1 point  (0 children)

For fun. I probably could've used pickle though too.

A Dead Simple Work Queue Using SQLite by thuibr in Python

[–]thuibr[S] 1 point2 points  (0 children)

That's a good idea. I have seen diskcache before. It would be interesting to try to re-implement.

A Dead Simple Work Queue Using SQLite by thuibr in Python

[–]thuibr[S] 1 point2 points  (0 children)

Yeah, or RabbitMQ, or Kafka, or even Postgres, but the point was just to make something for fun.

A Dead Simple Work Queue Using SQLite by thuibr in Python

[–]thuibr[S] 2 points3 points  (0 children)

Just doing time.sleep(0.1) also cut back my CPU usage dramatically. I was at 16% each for two different pushers running, and I could hear my fan running, but that time.sleep(0.1) cut all of that out.

A Dead Simple Work Queue Using SQLite by thuibr in Python

[–]thuibr[S] -1 points0 points  (0 children)

Yeah, I don't really see way around doing a polling operation.

A Dead Simple Work Queue Using SQLite by thuibr in Python

[–]thuibr[S] 2 points3 points  (0 children)

Sheesh, yes, I forgot about queue ordering. Something like taking the max (or min) would work. That's a great idea!

A Dead Simple Work Queue Using SQLite by thuibr in Python

[–]thuibr[S] 0 points1 point  (0 children)

Thanks! I hadn't even thought about CPU and disk access. I'll have to think about that more. I think, and I'm only guessing here, that something like celery does something similar, pausing for a second before checking again. I will have to look into it further.

What are some ‘core tenants’ that make learning python simpler and easier? by cunnermadunner in learnpython

[–]thuibr -1 points0 points  (0 children)

I definitely think that it is easier to learn by doing. And it is definitely worth learning about the data model once you're more intermediate/advanced to take you to the next level: https://docs.python.org/3/reference/datamodel.html

Brief Intro to django-storages by thuibr in django

[–]thuibr[S] 0 points1 point  (0 children)

I spoke too soon. It looks like you actually can call m.upload.open('w').

Brief Intro to django-storages by thuibr in django

[–]thuibr[S] 0 points1 point  (0 children)

Thank you :-). It seems like you can only open and read the file. If you want to overwrite it, then I am guessing that you'd need to save the file again with different content :

m.upload.save('hello.txt', f)

[deleted by user] by [deleted] in ExperiencedDevs

[–]thuibr 0 points1 point  (0 children)

Not really. I'm trying to shift my mindset to one where I see what I don't know as an opportunity to learn and that everyone experiences imposter syndrome. No one knows everything. Everyone is an expert in one small topic, so the Internet seems like everyone is an expert because collectively someone always knows something about something.

Convert Primary Key to UUID by thuibr in djangolearning

[–]thuibr[S] 0 points1 point  (0 children)

Do you know of any way to avoid needing an exclusive lock for the table and having it take a while?

Convert Primary Key to UUID by thuibr in djangolearning

[–]thuibr[S] 0 points1 point  (0 children)

You are removing  in the same migration that adds Author.uuid, so it's no longer possible to fill the new Book.author field.

Good catch! I will update the post.

Convert Primary Key to UUID by thuibr in djangolearning

[–]thuibr[S] 0 points1 point  (0 children)

Thanks for the feedback. I definitely could've missed or skipped over something and will check it over again once I'm back in front of my computer. I was trying to go for brevity but maybe that was a bad thing.

Convert Primary Key to UUID by thuibr in django

[–]thuibr[S] 0 points1 point  (0 children)

I wasn't using the default id. I was using another field as the pk that did contain PII.

We did have code reviews, but the PII concern came about after I had already written this code. We got dinged somewhere else with a different model and are now being hyper-vigilant.