-
Notifications
You must be signed in to change notification settings - Fork 348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documentation on Postgres setup #218
Comments
Follow-up: it was a bit more involved than just installing diff --git a/bookmarks/queries.py b/bookmarks/queries.py
index 17a7a35..0fa35de 100644
--- a/bookmarks/queries.py
+++ b/bookmarks/queries.py
@@ -1,4 +1,5 @@
from django.contrib.auth.models import User
+from django.contrib.postgres.aggregates import StringAgg
from django.db.models import Q, Count, Aggregate, CharField, Value, BooleanField, QuerySet
from bookmarks.models import Bookmark, Tag
@@ -31,7 +32,7 @@ def _base_bookmarks_query(user: User, query_string: str) -> QuerySet:
# Add aggregated tag info to bookmark instances
query_set = Bookmark.objects \
.annotate(tag_count=Count('tags'),
- tag_string=Concat('tags__name'),
+ tag_string=StringAgg('tags__name', delimiter=','),
tag_projection=Value(True, BooleanField()))
# Filter for user I don't know if there's a way to conditionally build queries dependant on the db engine in Django but I can look into this if you want to merge postgres support upstream, else I'll just maintain a fork without SQLite support. |
Thanks for looking into this. Yeah, this is unfortunately a bit of a bigger effort due to incompatible queries. Regarding supporting Postgres out of the box, it's hard for me to form an opinion on this regarding how much additional effort it would be for me to maintain that, especially since I don't use Postgres myself. For "official" support I would expect:
That's already quite a bit of stuff to keep up to date. Maybe checking the alternative, what would be the practicalities of maintaining a fork from your perspective? There's always the option to keep Postgres support in a separate project, and then gauge interest. If there is high demand we can reconsider moving support into this repo. |
I wouldn't mind maintaining postgres support here, including all your expectations - though I'd stop if I stop using linkding, so I understand if you're not willing the risk to get stuck with this or having to deprecate it. |
Yeah, I wouldn't really want to be in this situation and keep it so that I can maintain everything myself.
That would be an OK approach. The worst part is overriding |
Closing this for now, but feel free to share some results here if you come up with something. |
In case anybody ends up in this issue: I'm working in this repo. I ended up going for a normal fork. This PR has the changes I needed for postgres to work. @sissbruecker I needed to change importer.py which makes it seem to me that might be a bug that isn't caught in the test suite with SQLite, using postgres the test
|
It took me a while to figure out I can setup linkding to use other databases than SQLite, the docker installation instructions don't touch on db engine choice and the backup docs section only mentions SQLite as well. I only realized that was even possible when bumping into this comment searching for postgres in the issues, then I went digging in Django's docs.
Would a PR for postgres setup instructions be welcome?
Also, Django's postgres engine uses psycopg2, so I can't use the official images from the project. I'm fine building my own image on top of yours, as it's just a
pip install psycopg2
, though I think official images (tagged*-postgres
or something) would be seen as more trustworthy by other people. I'm happy to help here as well if it's something you're willing to doCheers, great project BTW!
The text was updated successfully, but these errors were encountered: