couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Johnson <>
Subject Re: create database from variable
Date Sun, 05 Dec 2010 23:50:26 GMT
import couchdb
db_name = strftime("%Y%m%d.%H%M%S")
couch = couchdb.Server('') = couch.create(db_name)

I have tried removing the period as well and that did not seem to work. If I statically assign
a value to db_name as opposed to using a command (db_name = 'abc123') everything seems to
work. Ultimately my goal is to be able to create dynamic databases, so if anyone has any ideas,
I am open.

Randall Leeds wrote:
> Maybe you can show us what you tried that didn't work?
> Perhaps it's just that a period ('.') is not allowed in a database name.
> On Wed, Dec 1, 2010 at 12:33, Chris Johnson<>  wrote:
>> I am relatively new to couch and have tried searching for the answer to
>> this, but have not been very successful. I currently use python for the bulk
>> of my  scripting and would like to start using couch for the database. The
>> challenge I am up against is that I am trying to create a database based on
>> a variable within a python script. I have tried using the couchdb library
>> and I have not been successful in using it with variable substitution.
>> As an example, I would like to create a new database each time the script is
>> run. The database name will be a time stamp
>>>>> db_name = strftime("%Y%m%d.%H%M%S")
>>>>> print db_name
>> 20101201.114428
>> Is there a way to create the database either directly using the actual
>> command or through variable substitution?
>> Chris

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message