Thursday, August 23, 2018

Re: Insert values in python manage.py shell using custom sql

Thank you..

I  am new to django,. 
How can we say the data are in order to django and it asked the value for the id column..
How can it get the last id column..
Thanks in advance

shanmu

On Fri 24 Aug, 2018, 12:13 AM Aware Fun, <rahulsharma82630@gmail.com> wrote:
We dont need to give primary key it automatically define the key.

rahul

On Thu, Aug 23, 2018, 11:20 PM Vishak Raj <vishak.shanmu@gmail.com> wrote:
Hello

Thanks for replying..

I have a confusion 

In normal python shell, we import sqlite3 and insert values without giving the  Id or primary key..

Why we giving primary key in django..
Is it possible to insert values without primary key like we give in python shell..

Thanks in advance

On Thursday, August 23, 2018, 'Vinod Kumar' via Django users <django-users@googlegroups.com> wrote:
By default model have id column , so you have to put value of id.

On Thu, Aug 23, 2018, 5:00 PM Vishak Raj <vishak.shanmu@gmail.com> wrote:
hello,

i am inserting the values in the table using custome sql in django shell..
p.execute('INSERT INTO webapp_information VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)',i)
i is the list of values
it shows the error:OperationalError: table webapp_information has 32 columns but 31 values were supplied
I created the only 31 columns in models.py

What to do.. thanks

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/10ad145e-5e0b-4d52-a8c9-54af6fa69fba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

************************************************************************

This e-mail and all attachments are intended solely for use by the intended recipient and may contain confidential / proprietary information of KiwiTech, LLC, subject to important disclaimers and conditions including restrictions on the use, disclosure, transfer or export of such information. If you have received this message in error or are not the named recipient(s), please immediately notify the sender at the telephone number stated above or by reply e-mail and delete this e-mail from your computer

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJOHC1xufhygtCtBOjxZhUf26oonYYLxaZeqv05QRJS%3DK%2BPOJQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


--
vishakraj

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFL71Cz5ZrAwDc2EgrXfX-QOLt-nL4tcM3fyMHGGRZQEjyrJJw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2B8bEuRd7uqkw2dHt3_3J7QqJvXFD4_Kt4bAVXS2ynQtf9B9_w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFL71CxZ7rL9u45evTtaLTSqzANO6uHGYMxTeAPu1Tcc2kLvDQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment