Union and Intersect in Django

You could use Q objects for #1: # Blogs who have either hockey or django tags. from django.db.models import Q Blog.objects.filter( Q(tags__name__iexact=”hockey”) | Q(tags__name__iexact=”django”) ) Unions and intersections, I believe, are a bit outside the scope of the Django ORM, but its possible to to these. The following examples are from a Django application called … Read more

Understanding Gitlab CI tags

Tags for GitLab CI and tags for Git are two different concepts. When you write your .gitlab-ci.yml, you can specify some jobs with the tag testing. If a runner with this tag associated is available, it will pickup the job. In Git, within your repository, tags are used to mark a specific commit. It is … Read more

TTL for a set member

No, this isn’t possible (and not planned either). The recommended approach is to use an ordered set with score set to timestamp and then manually removing expired keys. To query for non-expired keys, you can use ZRANGEBYSCORE $now +inf, to delete expired keys, ZREMRANGEBYSCORE -inf $now will do the trick. In my application, I simply … Read more

How to implement tag system

I believe you’ll find interesting this blog post: Tags: Database schemas The Problem: You want to have a database schema where you can tag a bookmark (or a blog post or whatever) with as many tags as you want. Later then, you want to run queries to constrain the bookmarks to a union or intersection … Read more

What is the most efficient way to store tags in a database?

One item is going to have many tags. And one tag will belong to many items. This implies to me that you’ll quite possibly need an intermediary table to overcome the many-to-many obstacle. Something like: Table: Items Columns: Item_ID, Item_Title, Content Table: Tags Columns: Tag_ID, Tag_Title Table: Items_Tags Columns: Item_ID, Tag_ID It might be that … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)