summaryrefslogtreecommitdiff
path: root/python/skytools/sqltools.py
diff options
context:
space:
mode:
authorMarko Kreen2007-07-25 10:14:23 +0000
committerMarko Kreen2007-07-25 10:14:23 +0000
commit06fd7509fcf0ff672e7151706ef3ed5fb6008d67 (patch)
treec09ad81199d1bde4367be9428a6c53c259c66c3e /python/skytools/sqltools.py
parent1fa22291f659bae109b603f67274fc3be615fda7 (diff)
skytools: docstring shuffle, hide/remove low-level/old stuff
Diffstat (limited to 'python/skytools/sqltools.py')
-rw-r--r--python/skytools/sqltools.py49
1 files changed, 2 insertions, 47 deletions
diff --git a/python/skytools/sqltools.py b/python/skytools/sqltools.py
index c0a057ca..2867a114 100644
--- a/python/skytools/sqltools.py
+++ b/python/skytools/sqltools.py
@@ -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
#