pip install txpostgres python from twisted.internet import reactor from twisted.internet.defer import inlineCallbacks from txpostgres import txpostgres @inlineCallbacks def perform_database_query(): connection_pool = txpostgres.ConnectionPool() conn = yield connection_pool.connection() result = yield conn.runQuery("SELECT * FROM users") for row in result: print(row) conn.close() reactor.stop() reactor.callWhenRunning(perform_database_query) reactor.run()


上一篇:
下一篇:
切换中文