[ess@jncama ess]$ ./a.py
WARNING: Python C API version mismatch for module _pg:
This Python has API version 1010, module _pg has version 1007.
010501.trf = 1992530 [ 11:48:38 / 11:48:40 ]
010502.trf = 1993013 [ 11:48:40 / 11:48:42 ]
010503.trf = 1992562 [ 11:48:42 / 11:48:43 ]
010504.trf = 1995547 [ 11:48:44 / 11:48:45 ]
010505.trf = 1991803 [ 11:48:46 / 11:48:47 ]
010506.trf = 1989938 [ 11:48:48 / 11:48:49 ]
010507.trf = 1995239 [ 11:48:50 / 11:48:51 ]
010508.trf = 1992950 [ 11:48:51 / 11:48:53 ]
010509.trf = 2030871 [ 11:48:53 / 11:48:55 ]
010510.trf = 2031421 [ 11:48:55 / 11:49:02 ]
010511.trf = 2032668 [ 11:49:03 / 11:49:05 ]
010512.trf = 2032315 [ 11:49:06 / 11:49:07 ]
010513.trf = 2031792 [ 11:49:08 / 11:49:10 ]
010514.trf = 2033491 [ 11:49:10 / 11:49:12 ]
010515.trf = 2033213 [ 11:49:13 / 11:49:14 ]
010516.trf = 2033374 [ 11:49:15 / 11:49:17 ]
010517.trf = 2034058 [ 11:49:17 / 11:49:19 ]
010518.trf = 2031919 [ 11:49:20 / 11:49:22 ]
010519.trf = 2032995 [ 11:49:22 / 11:49:24 ]
010520.trf = 2034100 [ 11:49:25 / 11:49:27 ]
010521.trf = 2037287 [ 11:49:28 / 11:49:30 ]
010522.trf = 87962 [ 11:49:30 / 11:49:30 ]
010523.trf = 2033477 [ 11:49:31 / 11:49:33 ]
('010501.trf', 1992530)
('010502.trf', 1993013)
('010503.trf', 1992562)
('010504.trf', 1995547)
('010505.trf', 1991803)
('010506.trf', 1989938)
('010507.trf', 1995239)
('010508.trf', 1992950)
('010509.trf', 2030871)
('010510.trf', 2031421)
('010511.trf', 2032668)
('010512.trf', 2032315)
('010513.trf', 2031792)
('010514.trf', 2033491)
('010515.trf', 2033213)
('010516.trf', 2033374)
('010517.trf', 2034058)
('010518.trf', 2031919)
('010519.trf', 2032995)
('010520.trf', 2034100)
('010521.trf', 2037287)
('010522.trf', 87962)
('010523.trf', 2033477)
Total 44494525 byte
[ess@jncama ess]$ cat a.py
#! /usr/local/bin/python
tst_path='/home/ess/var/emf/nkj'
sql1="""
create table tst_text
(
name text,
contents text
);
"""
import pg,time
d = pg.DB('ess')
try:
d.query(sql1)
d.query('truncate tst_text')
except: pass
for no in range(1,24):
tst_file='%s/0105%02d.trf' % (tst_path,no)
a=open(tst_file,'r').read()
t = time.strftime('%T',time.localtime(time.time()))
print '%s = %9d [ %s /' % (tst_file.split('/')[/1],len(a),t),
d.query( """insert into tst_text values('%s','%s');""" % (tst_file,a))
t = time.strftime('%T',time.localtime(time.time()))
print ' %s ]' % t
r00 = d.query('select name,length(contents) as len from tst_text').getresult()
tot = 0
for no in r00:
print (no[0].split('/')[/1],no[1])
try: tot += int(no[1])
except: pass
print 'Total %d byte' % tot
[ess@jncama ess]$
[ess@jncama ess]$ psql
Welcome to psql, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit
ess=> \q
ess=> select count(*),sum(length(contents)) from tst_text ;
count | sum
///////+//////////
23 | 44494525
(1 row)
ess=> \q
|