Skip to content

Commit 1bab216

Browse files
committed
Create db only if doesn't exist yet
1 parent f446930 commit 1bab216

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)