Julia: PostgreSQL のデータを読む (Read)
3362 ワード
postgre_read.jl
#! /usr/bin/julia
#
# postgre_read.jl
#
# Dec/28/2021
# --------------------------------------------------------------------
using LibPQ
using DotEnv
# --------------------------------------------------------------------
println("*** 開始 ***")
DotEnv.config()
user=ENV["user"]
password=ENV["password"]
data_base=ENV["data_base"]
str_connect = "dbname= " * data_base * " host=127.0.0.1 user=scott password=tiger123 port=5432"
conn = LibPQ.Connection(str_connect)
command = "select * from cities"
results = execute(conn, command)
for row in results
print(row[1],'\t',row[2],'\t')
println(row[3],'\t',row[4])
end
#
close(conn)
#
println("*** 終了 ***")
# --------------------------------------------------------------------
Author And Source
この問題について(Julia: PostgreSQL のデータを読む (Read)), 我々は、より多くの情報をここで見つけました https://qiita.com/ekzemplaro/items/0ef5160d9b72aeab5364著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .