Why Django ORM filter lists all the users?

I like to make a filter where user can search based on last_name or a regio(region). I made the query but it filters well only if I using the last_name filter, but the regio gives all the users in the db. I’m used before Sqlite3 and raw queries but now I like to learn ORM… Read More Why Django ORM filter lists all the users?

query optimization and improve performance

Child.objects.select_related("parent").filter(parent=parent_instance) or Child.objects.filter(parent=parent_instance).select_related("parent") which one is less time consuming I am not sure which one is taking minimum queries and improve performance >Solution : Both will result in the same query. It is not necessary to .select_related(…) [Django-doc] or .prefetch_related(…) [Django-doc] to filter. If you filter on a related item, it will just make JOINs. The idea… Read More query optimization and improve performance

How to build relevant auto generating tags recommendation model in python

How to Build a Relevant Auto Generating Tags Recommendation Model in Python One of the most important features of any blog or website is its ability to recommend relevant tags to users. This not only helps users find related content easily, but it also improves the overall user experience. In this blog post, we’ll show… Read More How to build relevant auto generating tags recommendation model in python

How to apply function that returns Result to each element of HashSet in Rust

As a language that aims for safety and performance, Rust provides a powerful data structure called HashSet that provides a fast and efficient way to store and retrieve unique values. HashSet is optimized for scenarios where you need to check for the presence of a value and avoid duplicates, making it a popular choice among… Read More How to apply function that returns Result to each element of HashSet in Rust

python – split query results into multiple objects based on one column

my program is querying a sqlite database, and thre result is like this (simplified) in the cursor ready to be fetched. connection = sqlite3.connect(IMAGE_LOG_DB_PATH) connection.isolation_level = None cur = connection.cursor() sql_query = "Select date, name, count(*) as sells from sellers group by date, name order by date asc;" cur.execute(sql_query) result = cur.fetchall() 2023-01-01 | John… Read More python – split query results into multiple objects based on one column

How to replace a commas with periods in text for decimal numbers in python

To replace commas with periods in text for decimal numbers in Python, you can use the `replace()` method of the `string` class. Here is an example of how you could do this: This will print the following output: Keep in mind that this will only work if the commas are used as decimal separators. If… Read More How to replace a commas with periods in text for decimal numbers in python