Skip to content

Commit c604e60

Browse files
committed
Merge pull request influxdata#274 from slomek/create-db-if-not-exist
Create db only if doesn't exist yet (Thanks @slomek !)
2 parents f446930 + 1bab216 commit c604e60

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

influxdb/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ def create_database(self, dbname):
460460
:param dbname: the name of the database to create
461461
:type dbname: str
462462
"""
463-
self.query("CREATE DATABASE \"%s\"" % dbname)
463+
self.query("CREATE DATABASE IF NOT EXISTS \"%s\"" % dbname)
464464

465465
def drop_database(self, dbname):
466466
"""Drop a database from InfluxDB.

0 commit comments

Comments
 (0)