DAY 14 资料库-透过pgAdmin4管理Heroku PostgreSQL

在上篇有透过psycopg2对PostgreSQL进行一连串的操作,在透过psycopg2人工创建资料表和插入更新删除资料过程比较麻烦,要查询资料也要将资料撷取下来然後print出来,所以这边用pgAdmin4来处理这些事情。

pgAdmin4

pgAdmin4是一个开源的PostgreSQL图性化管理工具,支援多个平台。

安装并开启pgAdmin4

https://www.pgadmin.org/download/pgadmin-4-windows/
https://ithelp.ithome.com.tw/upload/images/20210926/20140165ljRrQ9W9ub.png
https://ithelp.ithome.com.tw/upload/images/20210926/20140165o5Zve1rJ5C.png

连线至你的Heroku PostgreSQL

对Server右键 Create-->Server
https://ithelp.ithome.com.tw/upload/images/20210926/20140165WMed2N5Id5.png
General分页中输入你的Server名称
https://ithelp.ithome.com.tw/upload/images/20210926/20140165Klh9yc1r5u.png
Connection分页中输入你Database Credentials中资料
https://ithelp.ithome.com.tw/upload/images/20210926/20140165HG6INHD8T9.png
Advanced分页中在DB restriction填入你的Database Credentials中的资料库名称,这样就不会把主机位址下的资料库列出来,只显示你的资料库
https://ithelp.ithome.com.tw/upload/images/20210926/20140165NYvaVNhkcg.png
Save完成新增
https://ithelp.ithome.com.tw/upload/images/20210926/20140165lbbHVcyJXy.png

管理资料库

创建资料表

在你的资料库下的Schemas-->Table,对Table右键创建资料表
https://ithelp.ithome.com.tw/upload/images/20210926/201401650Q47wG0umG.png
可以由图形化添加资料行
https://ithelp.ithome.com.tw/upload/images/20210926/201401658EUsiO7aAZ.png

检视与编辑资料

右键资料表View/Edit Data这边有三个选项

  • All Rows 列出全部资料列
  • First 100 Rows 首100笔资料列
  • Last 100 Rows 末100笔资料列
  • Filtered Rows 筛选资料列
    https://ithelp.ithome.com.tw/upload/images/20210926/20140165Fl9xDvb9rq.png
    Filtered Rows可填入筛选条件筛选资料列
    https://ithelp.ithome.com.tw/upload/images/20210926/20140165kEUVhEC0TG.png
    可直接输入或更改资料,F6储存资料变更
    https://ithelp.ithome.com.tw/upload/images/20210926/20140165BsbT89PXQM.png

删除资料表

右键资料表-->Delete/Drop
https://ithelp.ithome.com.tw/upload/images/20210926/201401654uR2br1ru8.png

Query Tool

除了上方图形化操作外,也可以使用SQL语法查询。
对资料表右键-->Query Toolhttps://ithelp.ithome.com.tw/upload/images/20210926/20140165TPnOn7wtRX.png
在上方Query Editor中输入,F5执行
https://ithelp.ithome.com.tw/upload/images/20210926/20140165XGntKEuCZx.png


<<:  [Day11] 团队管理:团队共识与团队思考

>>:  [Python 爬虫这样学,一定是大拇指拉!] DAY11 - HTTP / HTTPS (2)

Material UI in React [ Day15 ] Navigation Stepper 步骤卡

Stepper Stepper 通过编号的步骤传达进度,它提供了类似向导的工作流程。 他除了有前面提...

[13th-铁人赛]Day 2:Modern CSS 超详细新手攻略 - 入门

WHO? WHAT? CSS到底是谁? CSS的全名为Cascading Style Sheets,...

Day 9 - Functional Programming 初探 (2) - Currying 与 Composition

前言 今天会继续来聊聊 FP 的一些重要观念,而且会更偏向实际的做法,看看 Javascript 怎...

IOS、Python自学心得30天 Day-17 learning rate

前言: 经过多次的测试和训练 val_accuracy 在最後几乎都是处於0.6500左右的状态 所...

33岁转职者的前端笔记-DAY 22 成绩计算机练习笔记

流程 1.先观察画面,哪些值需要抓 2.抓HTML的值: a.先宣告变数,变数就是抓HTML的值,也...