Thread: missing psycopg2 database
Hello, I have recently installed this package. The installation is successful in so far as I am able to connect to my server and a database and extract data from it. I was going through some tutorials and in the course of this I encountered the following: ---------------------------------------- $ python Python 2.6.5 (r265:79063, Oct 28 2010, 20:56:23) [GCC 4.5.0 20100604 [gcc-4_5-branch revision 160292]] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> help('modules keywords') Here is a list of matching modules. Enter any module name to get more help. keyword - Keywords (from "graminit.c") Failed connection to test db: OperationalError FATAL: database "psycopg2_test" does not exist Please set env vars 'PSYCOPG2_TESTDB*' to valid values. -------------------------------------------- My system: ---------------------------------------- $ uname -a Linux cm2 2.6.34.7-0.7-desktop #1 SMP PREEMPT 2010-12-13 11:13:53 +0100 x86_64 x86_64 x86_64 GNU/Linux ---------------------------------------- I poked around the module but did not see any language which looked like it would be used to create this database in my server. Would someone tell me what I missed or where to find the instructions for creating the psycopg2_test database? Thanks, Bill
On Wed, Mar 30, 2011 at 2:01 PM, Bill House <wch-tech@house-grp.net> wrote: >>>> help('modules keywords') > keyword - Keywords (from "graminit.c") > Failed connection to test db: OperationalError FATAL: database > "psycopg2_test" does not exist > > Please set env vars 'PSYCOPG2_TESTDB*' to valid values. > I poked around the module but did not see any language which looked like > it would be used to create this database in my server. > > Would someone tell me what I missed or where to find the instructions for creating the psycopg2_test database? The command you typed is probably trying to aggressively import everything it found. This is what is trying to do on my box: In [1]: help('modules keywords') Here is a list of matching modules. Enter any module name to get more help. keyword - Keywords (from "graminit.c") Speech Dispatcher configuration tool Do you want to setup a completely new configuration? [yes] : For you, looks like it's trying to import psycopg2.tests. I would say "don't do that". You don't need a test database unless you are running the test suite (in which case it just have to be an empty database). Nothing in psycopg imports the test module. However I don't like side effects at import time (and "sys.exit(1)" is probably a particularly unwanted one), so I'll change the test suite to not make that check at import time. Cheers, -- Daniele