summaryrefslogtreecommitdiff
path: root/scripts/cube_dispatcher.py
diff options
context:
space:
mode:
authorAsko Oja2009-05-04 14:02:39 +0000
committerMarko Kreen2009-06-01 07:49:44 +0000
commit9cbd16ab343c28c55012127a1cb643b793547416 (patch)
tree6a5b351db839396c8d6912d2a0eb90fe1c94d734 /scripts/cube_dispatcher.py
parent16e20c4daccb4f0e95249d8fcfe32e89bae41882 (diff)
python scripts: Move template config to docstring.
* Template config is now in docstring to make to more easy to keep up-to-date. * dbscript: --ini option to show template config.
Diffstat (limited to 'scripts/cube_dispatcher.py')
-rwxr-xr-xscripts/cube_dispatcher.py29
1 files changed, 28 insertions, 1 deletions
diff --git a/scripts/cube_dispatcher.py b/scripts/cube_dispatcher.py
index 55f4bc7c..9bd8fc3e 100755
--- a/scripts/cube_dispatcher.py
+++ b/scripts/cube_dispatcher.py
@@ -2,6 +2,32 @@
"""It accepts urlencoded rows for multiple tables from queue
and insert them into actual tables, with partitioning on tick time.
+
+Config template::
+
+ [cube_dispatcher]
+ job_name = cd_srcdb_queue_to_dstdb_dstcolo.ini
+
+ src_db = dbname=sourcedb_test
+ dst_db = dbname=dataminedb_test
+
+ pgq_queue_name = udata.some_queue
+
+ logfile = ~/log/%(job_name)s.log
+ pidfile = ~/pid/%(job_name)s.pid
+
+ # how many rows are kept: keep_latest, keep_all
+ mode = keep_latest
+
+ # to_char() fmt for table suffix
+ #dateformat = YYYY_MM_DD
+ # following disables table suffixes:
+ #dateformat =
+
+ part_template =
+ create table _DEST_TABLE (like _PARENT);
+ alter table only _DEST_TABLE add primary key (_PKEY);
+ grant select on _DEST_TABLE to postgres;
"""
import sys, os, pgq, skytools
@@ -12,7 +38,8 @@ alter table only _DEST_TABLE add primary key (_PKEY);
"""
class CubeDispatcher(pgq.SerialConsumer):
- """Partition on tick time, multiple tables."""
+ __doc__ = __doc__
+
def __init__(self, args):
pgq.SerialConsumer.__init__(self, "cube_dispatcher", "src_db", "dst_db", args)