#32672: Primary Key, type double and type unsigned integer ain't detected 
correctly
for Sqlite3 Database
-------------------------------------+-------------------------------------
     Reporter:  jgr88                |                    Owner:  Anvesh
         Type:                       |  Mishra
  Cleanup/optimization               |                   Status:  assigned
    Component:  Database layer       |                  Version:  3.2
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  SQLite3 PrimaryKey   |             Triage Stage:  Accepted
  Datatypes                          |
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  1
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Anvesh Mishra):

 So as per Charettes's comment on my PR
 https://github.com/django/django/pull/14878#discussion_r713268066, I
 implemented this issue with `sqlparse` but failed testcases one of them
 was `inspectdb.tests.InspectDBTestCase`. The change which I did was
 {{{
 method_match = sqlparse.parse(field_desc)[0]
 if method_match:
     if len(method_match.tokens) == 3 and method_match.tokens[0].value ==
 "PRIMARY":
         column_name_token = str(method_match.tokens[2])
         column_name = column_name_token[4:len(column_name_token) - 1]
         return column_name
     elif len(method_match.tokens) > 6 and method_match.tokens[6].value ==
 "PRIMARY":
         return str(method_match.tokens[0])
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32672#comment:9>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/073.e3348c057751b91214c43bf22c914b2f%40djangoproject.com.

Reply via email to