django-jython: I am getting an error when I run the migrate command on Jython-Django 1.7

81 views
Skip to first unread message

Pitchblack

unread,
Sep 8, 2014, 2:51:00 AM9/8/14
to django...@googlegroups.com

I hoping that you can help me out. I currently have Django1.7 running on windows7/Java7/Jython2.7/Postgresql9.3/postgresql-9.3-1102.jdbc41/django_jython-1.7.0b2-py2.7.

egg

I learned today that on Django 1.7 has makemigrations and migrate commands built in. But even so when I try to apply those commands in that order I am getting some sort of error. How can I resolve this error?

For more information on django migrations. Django 1.7 Migrations

For more details about django on jython and the database settings. postgresql on jython-django

After creating a project in Django and setting it all up and have  
everything running, I began to start creating models.


What steps will reproduce the problem?
1. I first created a model in django with some fields

from django.db import models

# Create your models here.
class Join(models.Model):
     email = models.EmailField(unique=True)
     ip_address = models.CharField(max_length=
120, default="ABC")
     #auto_now means when it was added, auto_now means when it is updated
     timestamp = models.DateTimeField(auto_now_add = True, auto_now=False)
     updated = models.DateTimeField(auto_now_add = False, auto_now=True)

     def __unicode__(self):
         return "%s" %(self.email)


2. I then run jython manage.py makemigrations joins
3. I then run jython manage.py migrate joins
4. Tables are created in database
5. I forgot to add a field using modeling, so I add it see ref_id below

from django.db import models

# Create your models here.
class Join(models.Model):
     email = models.EmailField(unique=True)
     ref_id = models.CharField(max_length=120, null=True)
     ip_address = models.CharField(max_length=120, default="ABC")
     #auto_now means when it was added, auto_now means when it is updated
     timestamp = models.DateTimeField(auto_now_add = True, auto_now=False)
     updated = models.DateTimeField(auto_now_add = False, auto_now=True)

     def __unicode__(self):
         return "%s" %(self.email)


6. I then run jython manage.py makemigrations joins
7. I then run jython manage.py migrate joins





What is the expected output?
I was expecting the new field to produce a new column for the existing  
table and the column to have default values of "ABC".


What do you see instead?
It errors out badly.

   
File "C:\jython2.7b2\Lib\site-packages\django_jython-1.7.0b2-py2.7.egg\doj\db\
backends\__init__.py", line 180, in execute
     self.cursor.execute(sql, params)
django.db.utils.Error: ERROR: could not determine data type of parameter $1  
[SQL
Code: 0], [SQLState: 42P18]

I have attached the entire error in a file to this post.


What version of the product are you using? On what operating system?
I currently have Django1.7c3 running on windows7, Java7, Jython2.7b2,  
Postgresql 9.3, postgresql-9.3-1102.jdbc41, and the  
django_jython-1.7.0b2-py2.7.egg


error.txt

Michael Martin

unread,
Sep 8, 2014, 2:55:24 PM9/8/14
to django...@googlegroups.com

I ran sqlmigrate because I understand that it creates the sql calls which are to be ran against the database via the database connecter.   I am not a DBA, but my first opinion is that the sql calls don't look right to me. Anybody out there know SQL for Postgresql really well?

C:\Users\mike\workspace\lwc>jython manage.py sqlmigrate joins 0002_join_ref_
id
BEGIN;
ALTER TABLE `joins_join` ADD COLUMN `ref_id` varchar(120) DEFAULT "ABC" NOT NULL
;
ALTER TABLE `joins_join` ALTER COLUMN `ref_id` DROP DEFAULT;

COMMIT;

--
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...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/db7a8702-ae47-4bb9-a58d-474c3efb8b19%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages