On adding comments to database schema

592 views
Skip to first unread message

vanadium23

unread,
Mar 7, 2018, 7:52:48 AM3/7/18
to Django developers (Contributions to Django itself)
Hello, fellows.

There was once a proposal about ability to add comments to table/columns in postgres: https://code.djangoproject.com/ticket/18468
I re-read discussion in ticket, and it has ended with another proposal, that now migrations is within Django, so we can add this feature.

I want to make it as a third-party libs, but has come to thought that need to extend SchemaEditor, but it's not good for maintainability.
Also, not only postgres has this feature, but also MySQL.

Motivation for this feature is that some sort of users can view code comments without access to VCS of the project.

Jani Tiainen

unread,
Mar 8, 2018, 5:01:14 AM3/8/18
to django-d...@googlegroups.com
Oracle supports comments as well.

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscribe@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/484264c0-b7d1-4264-b8b5-8857847f6b53%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Aymeric Augustin

unread,
Mar 10, 2018, 2:27:30 AM3/10/18
to django-d...@googlegroups.com
I think we could implement that feature.

(Yes I changed my mind from six years ago when I wontfix'd the ticket.)

-- 
Aymeric.



To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.

vanadium23

unread,
Mar 11, 2018, 4:34:46 AM3/11/18
to Django developers (Contributions to Django itself)
That's good. I'll prepare the patch for review.

суббота, 10 марта 2018 г., 10:27:30 UTC+3 пользователь Aymeric Augustin написал:
I think we could implement that feature.

(Yes I changed my mind from six years ago when I wontfix'd the ticket.)

-- 
Aymeric.



On 8 Mar 2018, at 11:00, Jani Tiainen <red...@gmail.com> wrote:

Oracle supports comments as well.
7.3.2018 2.52 ip. "vanadium23" <cherno...@gmail.com> kirjoitti:
Hello, fellows.

There was once a proposal about ability to add comments to table/columns in postgres: https://code.djangoproject.com/ticket/18468
I re-read discussion in ticket, and it has ended with another proposal, that now migrations is within Django, so we can add this feature.

I want to make it as a third-party libs, but has come to thought that need to extend SchemaEditor, but it's not good for maintainability.
Also, not only postgres has this feature, but also MySQL.

Motivation for this feature is that some sort of users can view code comments without access to VCS of the project.

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/484264c0-b7d1-4264-b8b5-8857847f6b53%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

vanadium23

unread,
Mar 18, 2018, 2:12:30 AM3/18/18
to Django developers (Contributions to Django itself)
Hi, community.

I've been stuck at realization, because Postgres and oracle have a syntax like comment on {table}.{column} for storing comments, so this needs to be done after table/column creation.

So there are two ways:
1. Add it to post migrate signal, as for content types. But I can implement it as a third-party lib
2. Add this SQL after database creation in schema.py
Which way is better?

воскресенье, 11 марта 2018 г., 11:34:46 UTC+3 пользователь vanadium23 написал:

Aymeric Augustin

unread,
Mar 18, 2018, 4:13:49 AM3/18/18
to django-d...@googlegroups.com
Hello,

My gut feeling is that I'd rather implement this in the migrations engine (your option 1) than bolt it on (the option 2).

Disclaimer — I don't know the migrations engine all that well.

Best regards,

-- 
Aymeric.



Mauricio Cordero

unread,
Jun 4, 2019, 5:29:21 PM6/4/19
to Django developers (Contributions to Django itself)
Hello all, just wondering if this feature was ever implemented. 

vanadium23

unread,
Jun 5, 2019, 1:22:53 AM6/5/19
to Django developers (Contributions to Django itself)
I've made it as a separate django libm but only for PostgresSQL:

среда, 5 июня 2019 г., 0:29:21 UTC+3 пользователь Mauricio Cordero написал:

Adam Johnson

unread,
Jun 5, 2019, 3:14:25 AM6/5/19
to django-d...@googlegroups.com
Mauricio, the ticket tracker doesn't tend to get out of sync, so you can see the ticket is still open and waiting for an implementation: https://code.djangoproject.com/ticket/18468

If you want to help, you can start with the "writing your first patch for django" tutorial: https://docs.djangoproject.com/en/dev/intro/contributing/

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.

For more options, visit https://groups.google.com/d/optout.


--
Adam

SoungRyoul Kim

unread,
Mar 23, 2020, 7:43:13 AM3/23/20
to Django developers (Contributions to Django itself)


i assign it to me


i will close this pullRequest caused by imperfection
https://github.com/django/django/pull/12605

I will bring a new PullRequest as soon as possible.

in at least a week

SoungRyoul Kim

unread,
Apr 10, 2020, 8:20:23 AM4/10/20
to Django developers (Contributions to Django itself)
add parameter "db_column_comment" to Field() 
and. db_table_comment
class AModel(models.Model):
     aaa = model.CharField(help_text="i am help_text", db_column_comment="i am db_comment",~~~)
     
     class Meta:
           db_table = "a_model_example_name"
           db_table_comment ="this is a_model comment ~~~~"

SoungRyoul Kim

unread,
May 2, 2020, 3:39:26 AM5/2/20
to Django developers (Contributions to Django itself)

Hi felixxm

I want this feature to be reflected in Django.3.1

I know this feature that many people won't use.

but some people who communicate with DBA would be helpful this feature

sometimes ORM take control from DBA


like these situation...

DBAs: we want to know comment(help_text) not to *.py  could you use COMMENT SQL in migrationFile?

Developers: No, It's Impossible because django ORM does not support COMMENT SQL

DBAs: ???? that means .. should we refer *.py file everytimes even though COMMENT SQL exists but can't use?  
DBAs: it's illogical!!!!

Developers: but if we use COMMENT SQL, we customize everytimes to generate migrate files
Developers: it's inefficient!!!!


That's one of the reasons for avoiding ORM.


If you don't mind me asking...
could you give me a feedback to this feature?

https://github.com/django/django/pull/12605


Mariusz Felisiak

unread,
May 2, 2020, 12:42:02 PM5/2/20
to Django developers (Contributions to Django itself)
Asking for a review on multiple channels doesn't help. You need to be patient, we have many PRs in review queue. Please check "Patch review checklist" [1]. At first glance, docs are missing.

SoungRyoul Kim

unread,
May 3, 2020, 1:24:46 AM5/3/20
to Django developers (Contributions to Django itself)
I'm sorry if I sounded like I was pushing you. 

even missing checklist


2020년 5월 3일 일요일 오전 1시 42분 2초 UTC+9, Mariusz Felisiak 님의 말:

Jared Chung

unread,
May 6, 2021, 9:17:00 AM5/6/21
to Django developers (Contributions to Django itself)
KimSoungRyoul it looks like there is feedback on the PR you created (PR #12605) and Marius also pointed out that docs and tests are missing. Would you like help with the docs and tests? We've recently added some data scientists and dbas to our team and I immediately saw the significant value in ticket 28822. You're marked as the ticket owner right now, but I'd love to help out with docs and tests if you feel that the rest of the implementation is solid (or if you are willing to update your PR based on the feedback from Mads Jensen (atombrella).
(Full disclosure: I'm new to contributing to django, but hoping that this can be my first contribution. I've been thankful to use Django at work for 9 years now!) 


Jared Chung

unread,
May 6, 2021, 9:17:00 AM5/6/21
to Django developers (Contributions to Django itself)
KimSoungRyoul would you like help with writing the docs and tests for this? I'd like to contribute to Django in some way and this is a feature my company would greatly value (we have Data Scientists and DBAs interacting with db tables managed by Django, so having comment documentation at the DB level would have a huge positive impact). It looks like you received feedback on your PR and Mariusz pointed out that docs and tests are needed. I'd be happy to help out with the docs and tests if I can. You're marked as ticket owner right now on ticket 18468. Please let me know!
(Disclosure: I'm new to contributing to Django, and hopeful that this can be a good ticket for me to start with. I've been using Django now for a decade and am excited to start giving back!)

On Saturday, May 2, 2020 at 10:24:46 PM UTC-7 kimsou...@gmail.com wrote:

Tom Carrick

unread,
May 6, 2021, 9:39:45 AM5/6/21
to django-d...@googlegroups.com
It's funny that you bring this up, I was actually looking at this today and thinking about picking it up next week.

Jared, the PR was closed without any comment from the author and is seemingly abandoned. I think it's safe for you to assign the ticket to yourself and continue the work in a new PR at this point - that was going to be my plan, anyway.

Tom

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.

Jared Chung

unread,
May 8, 2021, 1:45:42 PM5/8/21
to Django developers (Contributions to Django itself)
Thank you Tom. I'll go ahead and do that. I may seek some advice in django-core-mentorship since this is my first time working on a patch.
KimSoungRyoul I hope you don't mind that I proceed with reassignment. If you remain interested, please let me know and I'd love to collaborate with you on it together. Otherwise I'll give it my best shot. 

Reply all
Reply to author
Forward
0 new messages