#adding timescale through runSQL

2 messages · Page 1 of 1 (latest)

rapid isle
green whale
#

Hello! I've used Timescale with Django in the way you describe, with unmanaged models and SQL migrations. It worked fine 😄 The one caveat we had was that our hypertables had composite primary keys, think (timestamp, some_id) which is a feature that was not supported in Django at the time so we had to define just the timestamp as the PK in the model, kind of "lying" to django.

One of my teammates at the time actually gave a talk about this at DjangoCon US so I'll share the link https://www.youtube.com/watch?v=hXctK2NQTsc

Also of note, composite primary keys are coming to Django soon! there's a PR in progress for it https://github.com/django/django/pull/18056

Not many people would think that using Django and a PostgreSQL database is a good idea for working with time series data and all its complexity in terms of volume and structure. However, we found out that even the most unusual choices can work, if you have a good reason for doing so. In this talk, we will share our successful experience developi...

▶ Play video
GitHub

[GSoC-2024]
Trac ticket number
ticket-373
Branch description
This branch adds the CompositePrimaryKey field. If present, Django will create a composite primary key.
Please refer to the docs for a m...