I have the following model of a blog post:
title = db.Column(db.String())
content = db.Column(db.String())
tags = db.Column(ARRAY(db.String))
Tags field can be an empty list.
Now I want to select all distinct tags from the database entries with max performance - excluding empty arrays.
So, say I have 3 records with the following values of the tags field:
- ['database', 'server', 'connection']
- []
- ['connection', 'security']
The result would be ['database', 'server', 'connection', 'security']
The actual order is not important.