Skip to content

Table extensions examples#721

Draft
fstagni wants to merge 1 commit intoDIRACGrid:mainfrom
fstagni:table_extensions_examples
Draft

Table extensions examples#721
fstagni wants to merge 1 commit intoDIRACGrid:mainfrom
fstagni:table_extensions_examples

Conversation

@fstagni
Copy link
Contributor

@fstagni fstagni commented Dec 18, 2025

No description provided.

@fstagni fstagni force-pushed the table_extensions_examples branch from d6e65f9 to 7d97288 Compare December 18, 2025 16:16
@fstagni fstagni marked this pull request as ready for review December 19, 2025 09:24
@chrisburr
Copy link
Member

Closing this until we have a use case to consider.

@chrisburr chrisburr closed this Jan 13, 2026
@fstagni
Copy link
Contributor Author

fstagni commented Jan 13, 2026

I do not agree with closing this one. It provides examples and a much needed documentation that I do not see anywhere else.

@fstagni fstagni reopened this Jan 13, 2026
@chaen chaen force-pushed the table_extensions_examples branch from 7d97288 to e8ac428 Compare January 14, 2026 16:28
Copy link
Member

@chrisburr chrisburr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is mixing pyproject.toml changes with DB changes and also needs to have the column modification example removed.

@chrisburr chrisburr marked this pull request as draft February 16, 2026 15:29
@fstagni fstagni force-pushed the table_extensions_examples branch from e8ac428 to c750103 Compare February 16, 2026 16:41
@read-the-docs-community
Copy link

read-the-docs-community bot commented Feb 16, 2026

Documentation build overview

📚 diracx | 🛠️ Build #31554151 | 📁 Comparing 0387ff6 against latest (6e85d84)


🔍 Preview build

Show files changed (1 files in total): 📝 1 modified | ➕ 0 added | ➖ 0 deleted
File Status
dev/explanations/extensions/index.html 📝 modified

@aldbr aldbr force-pushed the table_extensions_examples branch from c750103 to c9809fe Compare February 17, 2026 10:30
@fstagni fstagni marked this pull request as ready for review February 23, 2026 14:13
@aldbr aldbr force-pushed the table_extensions_examples branch from c9809fe to 5c8c5aa Compare February 24, 2026 10:53
@aldbr aldbr closed this Feb 25, 2026
@aldbr aldbr reopened this Feb 25, 2026
@aldbr aldbr force-pushed the table_extensions_examples branch from 5c8c5aa to 0387ff6 Compare February 25, 2026 13:14
@aldbr aldbr requested a review from chrisburr February 25, 2026 13:20
@aldbr
Copy link
Contributor

aldbr commented Feb 26, 2026

Just wondering, do we even give the possibility of extending DBs by adding columns?
Is there any use case? From what I understand, only LHCb is concerned.

@fstagni
Copy link
Contributor Author

fstagni commented Feb 26, 2026

Just wondering, do we even give the possibility of extending DBs by adding columns? Is there any use case? From what I understand, only LHCb is concerned.

It is easy enough, I do not see why not, and at least an example exists.

@chrisburr
Copy link
Member

It is easy enough, I do not see why not, and at least an example exists.

What happpens when we want to add a column to a table which then conflicts with what someone did in their extension? If we do automatic schema evolutions is it safe or do we risk accidentally dropping a column?

@aldbr
Copy link
Contributor

aldbr commented Feb 26, 2026

It is generally safer for extensions to use "has-a" relationships (new table with Foreign Key) rather than "is-a" relationships (inheriting/modifying an existing table). The systems I've looked at that provide extension mechanisms similar to ours all rely on "has-a", which we already support. See for example https://docs.djangoproject.com/en/5.2/ref/contrib/contenttypes/#generic-relations

@fstagni
Copy link
Contributor Author

fstagni commented Feb 26, 2026

It is easy enough, I do not see why not, and at least an example exists.

What happpens when we want to add a column to a table which then conflicts with what someone did in their extension? If we do automatic schema evolutions is it safe or do we risk accidentally dropping a column?

Good points, they can be added to the documentation of existing risks.
In general, from a pure technical point of view, we can't forbid anything to be done in an extension, at the same time they are "AT YOUR RISK" changes. I agree best practice is to use "has-a" relationships.

@aldbr aldbr marked this pull request as draft February 26, 2026 16:15
@chrisburr
Copy link
Member

Of course, people can also monkeypatch diracx and do anything they want.

We had said that gubbins contains examples of everything that supports being extended and if you do anything that isn't included in there you should open an issue. Until someone comes up with a valid used case, I don't think we should document things that might come to bite us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants