Now allows the stats and main archive database to be combined into one database.

V2.0.2rc1
This commit is contained in:
Tom Keffer
2012-11-07 17:53:10 +00:00
parent cfcfb31615
commit f87cd696b3
4 changed files with 38 additions and 5 deletions

View File

@@ -12,7 +12,7 @@
"""
import time
__version__="2.0.1"
__version__="2.0.2rc1"
# Holds the program launch time in unix epoch seconds:
# Useful for calculating 'uptime.'

View File

@@ -171,7 +171,7 @@ class StatsDb(object):
stats = StatsDb.open(stats_db_dict)
# The database exists and has been initialized. Return it.
return stats
except weedb.OperationalError, weewx.UninitializedDatabase:
except (weedb.OperationalError, weewx.UninitializedDatabase):
pass
# First try to create the database. If it already exists, an exception
@@ -594,9 +594,12 @@ class StatsDb(object):
# Some stats database have schemas for heatdeg and cooldeg (even though
# they are not used) due to an earlier bug. Filter them out. Also,
# filter out the metadata table:
stats_types = [s for s in raw_stats_types if s not in ['heatdeg','cooldeg','metadata']]
# filter out the metadata table. In case the same database is being used
# for the archive data, filter out the 'archive' database.
stats_types = [s for s in raw_stats_types if s not in ['heatdeg','cooldeg','metadata', 'archive']]
if not stats_types:
raise weedb.OperationalError("Uninitialized stats database")
return stats_types

View File

@@ -668,6 +668,36 @@ Mutating actions will request confirmation before proceeding.</pre>
<p class="tty">
<em>$WEEWX_ROOT</em>/bin/config_vp.py $WEEWX_ROOT/weewx.conf
--set-bucket=2</p>
<h2>Configuring MySql</h2>
<p>This section can be ignored if you are not using MySQL.</p>
<p>Assuming that you use the default database configurations, your
<span class="code"><a href="#[Databases]">[Databases]</a></span>
section will look like:</p>
<pre> [[archive_mysql]]
host = localhost
user = weewx
password = weewx
database = weewx
driver = weedb.mysql
[[stats_mysql]]
host = localhost
user = weewx
password = weewx
database = stats
driver = weedb.mysql</pre>
<p>You will need to give the necessary permissions for databases '<span class="code">weewx</span>'
and '<span class="code">stats</span>' to whatever MySQL
user you choose, by default, user '<span class="code">weewx</span>'. Here would be the
necessary permissions:</p>
<pre>mysql&gt; CREATE USER 'weewx'@'localhost' IDENTIFIED BY 'weewx';
mysql&gt; GRANT select, update, create, delete, insert ON weewx.* TO weewx@localhost;
mysql&gt; GRANT select, update, create, delete, insert ON stats.* TO weewx@localhost;</pre>
<p>This assumes user '<span class="code">weewx</span>' would have
password '<span class="code">weewx</span>'. If you wish, databases '<span class="code">weewx</span>'
and '<span class="code">stats</span>' can be combined into one
database, although this will make it harder to drop the latter
should you need to rebuild it at a later time.</p>
<h2>Editing the configuration file <span class="code">weewx.conf</span></h2>
<p>
Station specific information is set in the configuration file <em> <span class="code">$WEEWX_ROOT/weewx.conf</span></em>. (There is another

View File

@@ -32,7 +32,7 @@ WEEWX_ROOT = /home/weewx
socket_timeout = 20
# Current version
version = 2.0.1
version = 2.0.2rc1
############################################################################################