django requires db access to dump sql that it would use in syncdb

17 views
Skip to first unread message

msoulier

unread,
Dec 17, 2007, 12:45:26 PM12/17/07
to Django users
I'm trying to write db initialization code for an existing db
framework on a product that I work on. To do this I'm "asking" django
to show SQL that it would use to create its db, so I can copy it into
the initialization code.

I can't though, as I haven't created the db yet, and for some reason
it requires access to the db, even though it's not actually performing
any operations on the db.

[root@vmware-espresso servermanager]# python manage.py sql main
BEGIN;
Traceback (most recent call last):
File "manage.py", line 12, in ?
execute_manager(settings)
File "/var/tmp/django-0.96-root/usr/lib/python2.3/site-packages/
django/core/management.py", line 1672, in execute_manager
File "/var/tmp/django-0.96-root/usr/lib/python2.3/site-packages/
django/core/management.py", line 1632, in execute_from_command_line
File "/var/tmp/django-0.96-root/usr/lib/python2.3/site-packages/
django/core/management.py", line 123, in get_sql_create
File "/var/tmp/django-0.96-root/usr/lib/python2.3/site-packages/
django/core/management.py", line 68, in _get_table_list
File "/var/tmp/django-0.96-root/usr/lib/python2.3/site-packages/
django/db/backends/postgresql_psycopg2/base.py", line 48, in cursor
psycopg2.OperationalError: FATAL: Password authentication failed for
user "smeserver"

Seems like a bit of a chicken and egg problem. I'll create the db and
user now, but I don't see why it should be required when it's not
being used by the command. I suppose it might not be fixable, as it
may be in the psycopg2 module.

Mike

Malcolm Tredinnick

unread,
Dec 18, 2007, 9:03:45 PM12/18/07
to django...@googlegroups.com

Unfortunate, but not really worth worrying about. This is such an
edge-case that this isn't really worth putting in any significant extra
code to work around. Just create the database and you won't have the
problem.

It's so rare as to be effectively non-existent that you'll be wanting to
view the SQL and never, ever connect to the database.

Malcolm

--
Tolkien is hobbit-forming.
http://www.pointy-stick.com/blog/

Reply all
Reply to author
Forward
0 new messages