반응형
sqlite ][ where절 사용 해보기
■ 사용법
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# write by kyoung chip , jang | |
# python 2.7 | |
# | |
import os | |
import sys | |
import sqlite3 | |
def select_db_for_where( dbfile, where_val ) : | |
conn = sqlite3.connect( dbfile ) | |
curr = conn.cursor() | |
exp = """SELECT * FROM balance WHERE address = '%s'"""% where_val | |
curr.execute( exp ) | |
for j in curr : | |
yield j[0] , j[1] , j[2] | |
curr.close() | |
if __name__ == '__main__': | |
for addr , val , height in select_db_for_where( './0x01-add-db/test.jdb' , '13Q6u4oeRbXufrSwckgTJjEQV4x5AGex8r' ) : | |
print(" \n\raddr = %s " % addr ) | |
반응형
'Python > 0x10-sqlite' 카테고리의 다른 글
directory scan][ 지정 directory 내의 모든 sqlite 파일 select 해보기 (0) | 2019.08.30 |
---|---|
sqlite ][ select 해보기 (0) | 2019.08.27 |