josephramsay / lds_replicate

Replication scripts for LDS (LINZ Data Service).
http://data.linz.govt.nz/
2 stars 1 forks source link

Allow user to connect to a PostgreSQL database with just dbname #11

Closed palmerj closed 11 years ago

palmerj commented 11 years ago

The minimum requirements to connect to a postgresql database is dbname e.g

pg_ds = ogr.Open( 'PG:dbname=mydb' )

But currently host, port, user, password are always set.

I would suggest making all of the connection parameters above optional and only append them to the connection string if the user really sets them. That might mean you need to comment them out in the base ldsincr.conf config

josephramsay commented 11 years ago

Fixed. This was the intended behaviour, just had to add to condition checking for blank user/pass string in the URI builder

usr = " user='{}'".format(self.usr) if self.usr is not None and not all(i in string.whitespace for i in self.usr) else ""