skytools: docstring shuffle, hide/remove low-level/old stuff
authorMarko Kreen <markokr@gmail.com>
Wed, 25 Jul 2007 10:14:23 +0000 (10:14 +0000)
committerMarko Kreen <markokr@gmail.com>
Wed, 25 Jul 2007 10:14:23 +0000 (10:14 +0000)
python/skytools/__init__.py
python/skytools/psycopgwrapper.py
python/skytools/scripting.py
python/skytools/sqltools.py

index 06018721036139c5c3870f679602f0126e603b36..f15fba5d611adfbf1657217b19fc0d715420faf2 100644 (file)
@@ -1,6 +1,7 @@
 
 """Tools for Python database scripts."""
 
+
 from psycopgwrapper import *
 from config import *
 from dbstruct import *
@@ -9,3 +10,12 @@ from scripting import *
 from sqltools import *
 from quoting import *
 
+__all__ = (psycopgwrapper.__all__
+        + config.__all__
+        + dbstruct.__all__
+        + gzlog.__all__
+        + scripting.__all__
+        + sqltools.__all__
+        + quoting.__all__ )
+
+del psycopgwrapper, config
index 36b411247fb5dc1af676669b25a960b119b48000..043aabbd589ee0815a78f02c215a60b32c1c5307 100644 (file)
@@ -9,7 +9,7 @@ Interface provided is psycopg1:
 
 """
 
-__all__ = ["QuotedString", "connect_database"]
+__all__ = []
 
 try:
     ##from psycopg2.psycopg1 import connect as _pgconnect
index 058ff5233b57fa301b23835b7ab1e492b4ec91bf..71cf3f891e9edd12c1ad1cacea0e958e0e455e88 100644 (file)
@@ -8,8 +8,8 @@ from skytools.config import *
 from skytools.psycopgwrapper import connect_database
 import skytools.skylog
 
-__all__ = ['daemonize', 'run_single_process', 'DBScript',
-    'I_AUTOCOMMIT', 'I_READ_COMMITTED', 'I_SERIALIZABLE']
+__all__ = ['DBScript', 'I_AUTOCOMMIT', 'I_READ_COMMITTED', 'I_SERIALIZABLE']
+#__all__ += ['daemonize', 'run_single_process']
 
 #
 # daemon mode
index c0a057ca00c501d8ad55e5d69b226fdd948d2276..2867a114665b4df7fca48eeb377f6273fafccf94 100644 (file)
@@ -10,9 +10,8 @@ __all__ = [
     "fq_name_parts", "fq_name", "get_table_oid", "get_table_pkeys",
     "get_table_columns", "exists_schema", "exists_table", "exists_type",
     "exists_function", "exists_language", "Snapshot", "magic_insert",
-    "db_copy_from_dict", "db_copy_from_list", "CopyPipe", "full_copy",
-    "DBObject", "DBSchema", "DBTable", "DBFunction", "DBLanguage",
-    "db_install",
+    "CopyPipe", "full_copy", "DBObject", "DBSchema", "DBTable", "DBFunction",
+    "DBLanguage", "db_install",
 ]
 
 
@@ -230,50 +229,6 @@ def magic_insert(curs, tablename, data, fields = None, use_insert = 0):
         hdr = "%s (%s)" % (tablename, ",".join(fields))
         curs.copy_from(buf, hdr)
 
-def db_copy_from_dict(curs, tablename, dict_list, fields = None):
-    """Do a COPY FROM STDIN using list of dicts as source."""
-
-    if len(dict_list) == 0:
-        return
-
-    if fields == None:
-        fields = dict_list[0].keys()
-
-    buf = StringIO()
-    for dat in dict_list:
-        row = []
-        for k in fields:
-            row.append(quote_copy(dat[k]))
-        buf.write("\t".join(row))
-        buf.write("\n")
-
-    buf.seek(0)
-    hdr = "%s (%s)" % (tablename, ",".join(fields))
-
-    curs.copy_from(buf, hdr)
-
-def db_copy_from_list(curs, tablename, row_list, fields):
-    """Do a COPY FROM STDIN using list of lists as source."""
-
-    if len(row_list) == 0:
-        return
-
-    if fields == None or len(fields) == 0:
-        raise Exception('Need field list')
-
-    buf = StringIO()
-    for dat in row_list:
-        row = []
-        for i in range(len(fields)):
-            row.append(quote_copy(dat[i]))
-        buf.write("\t".join(row))
-        buf.write("\n")
-
-    buf.seek(0)
-    hdr = "%s (%s)" % (tablename, ",".join(fields))
-
-    curs.copy_from(buf, hdr)
-
 #
 # Full COPY of table from one db to another
 #