couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Lehnardt <>
Subject Re: create database from variable
Date Mon, 06 Dec 2010 01:16:52 GMT

On 6 Dec 2010, at 00:50, Chris Johnson wrote:

> 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.

Databases must start with a lowercase character.

See for details.


> 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

View raw message