1、导出csv表
from settings_Address import *
from sqlalchemy import create_engine, MetaData
import pandas as pd
def create_conn(Postgis_user,Postgis_password,Postgis_host,Postgis_port,dbname_PG):
# return create_engine('Postgis+pyPostgis://{}:{}@{}:{}/{}'.format(Postgis_user,Postgis_password,Postgis_host,Postgis_port,dbname_PG))
return create_engine('postgresql://{}:{}@{}:{}/{}'.format(Postgis_user,Postgis_password,Postgis_host,Postgis_port,dbname_PG))
def save_csv(table_name):
# 建立连接
conn=create_conn(Postgis_user,Postgis_password,Postgis_host,Postgis_port,dbname_PG)
query = "SELECT * FROM {}".format(table_name)
df = pd.read_sql_query(query, conn)
df.to_csv("./data/"+table_name+".csv", index=False)
print("导出数据成功:","./data/"+table_name+".csv")
if __name__ == "__main__":
save_csv("smssencoding")
2、Arcgis中csv表导入gdb
文章来源:https://www.toymoban.com/news/detail-688794.html
3、Qgis中gdb导入postgis
直接拖过去
再导入postgis数据库中
文章来源地址https://www.toymoban.com/news/detail-688794.html
到了这里,关于postgis数据库导出csv表再导入postgis的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!