HI there, i have done using node-fetch to get data from api url, however i am having problem in sending data to postgresql, i am thinking using node-postgres to send data, but i not so familiar, can you suggest any other ways? Thank you.
- M@marc_lin
Hi @souwei,
For sending data to the PostgresSQL, please refer to the source code mqtt-postgres-k8s in the level 2 training course.
https://github.com/WISE-PaaS/mqtt-postgres-k8s
https://training.wise-paas.advantech.com/zh-TW/Level-II/content/DB-Source_Code_InspectionThank you~
- In reply tomarc_lin⬆:Stan sou wei @souwei
hi sir, i have tried with the method you gave, with the credential key also, i able to get the data view using ingress url, but the table is missing when i want to make dashboard. i am using the code to create table.
module.exports.sqlCreatTable =CREATE SCHEMA "final_projects"; ALTER SCHEMA "final_projects" OWNER TO "g_final_project"; CREATE TABLE IF NOT EXISTS "final_projects"."temperature_souwei_tan"( id serial, timestamp timestamp without time zone NOT NULL DEFAULT (current_timestamp AT TIME ZONE 'UTC+0'), temperature integer, PRIMARY KEY (id) ); ALTER TABLE "final_projects"."temperature_souwei_tan" OWNER to "g_final_project"; GRANT ALL ON ALL TABLES IN SCHEMA "final_projects" TO "g_final_project"; GRANT ALL ON ALL SEQUENCES IN SCHEMA "final_projects" TO "g_final_project";
;- Stan sou wei @souwei
I try to find the temperature_souwei_tan but its not there for selection. i check with the url of mine, and it is fine and responded 200 ok. I am sorry for not so good at it. Thank you
http://final-project-demo-souwei-tan-level2-eks004.sa.wise-paas.com/Hi @souwei,
You might implement previous course unit of Level 2 then do the final project.
Please try to use the same method in the previous course unit to check the table in the Postgresql by PGadmin first.
(https://training.wise-paas.advantech.com/zh-TW/Level-II/content/DB-Test_Group_Locally)- Stan sou wei @souwei
hi sir, as mentioned by you, i able to create table and the timezone i set with timezone, but i did not showed value in dashboard.
is my coding wrong? i use the time zone code as below
timestamp timestamp with time zone
default (TIMESTAMP '2020-03-17 09:00:00' AT TIME ZONE 'JST')Hi @souwei,
How do you confirm the table you constructed?
Have you made sure the table you built in the Progressql by the PGadmin as I mentioned before?
If yes, try to check the data source setting of the table you use in the Dashboard.- Stan sou wei @souwei
Hi sir, this is how i observed that i have create my table in postgresql. sorry if i did not show clear info to you. ok i will check the dashboard setting. thanks
Our final-project-demo architecture is to connect the local data to the wise-paas (external cloud) , so the host needs to use external host, you can view postgresql secret in portal-service and find the external host .
host:Internal connection for use
External host:External connection for use