日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

aws rds同步_将数据从Python同步到AWS RDS

發布時間:2023/12/15 python 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 aws rds同步_将数据从Python同步到AWS RDS 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

aws rds同步

什么是Amazon Web Services? (What is Amazon Web Services?)

Amazon Web Services is the cloud platform provided by the Amazon company. It is one of the most frequently emphasized / sought-after platforms in job postings such as data scientist and data engineer. In today’s world, cloud platforms are becoming more and more important as big data grows day by day. In addition to flexibility, speed and practicality, cloud platforms like AWS are built on the philosophy of spending as much as you use with their scalable cost. Many startups, world giants, government agencies use AWS.

亞馬遜網絡服務是亞馬遜公司提供的云平臺 。 它是職位發布中最經常強調/最受歡迎的平臺之一,例如數據科學家和數據工程師。 在當今世界,隨著大數據的日趨增長,云平臺變得越來越重要。 除了靈活性,速度和實用性之外,AWS等云平臺還建立在可擴展成本的基礎上,使您花費盡可能多的費用。 許多創業公司,世界巨頭,政府機構都在使用AWS。

什么是AWS RDS(關系數據庫服務)? (What is AWS RDS (Relational Database Service)?)

AWS RDS is the service for creating a traditional database service on the AWS platform. It can be installed very quickly and stands up immediately. You pay as much as you use within the scope of the need. You can resize according to the increasing data size and your need for speed.

AWS RDS是用于在AWS平臺上創建傳統數據庫服務的服務。 它可以快速安裝并立即站起來。 您可以根據需要支付盡可能多的費用。 您可以根據不斷增長的數據大小對速度的需求來調整大小 。

If you install the RDS system on AWS, you don’t have to deal with hardware. You do not spend much time for database setup, and operations such as backup are done automatically. Often you just need to play with a few parameters and powers.

如果在AWS上安裝RDS系統,則無需處理硬件。 您無需花費太多時間進行數據庫設置,并且備份之類的操作是自動完成的。 通常,您只需要玩幾個參數和功能。

AWS RDS supports AWS Aurora, PostgreSQL, MySQL, MariaDB, ORACLE, Microsoft SQL database infrastructures.

AWS RDS支持AWS Aurora,PostgreSQL,MySQL,MariaDB,ORACLE,Microsoft SQL數據庫基礎架構。

Photo by Caspar Camille Rubin on Unsplash Caspar Camille Rubin在Unsplash上拍攝的照片

Let’s Start Creating Database on AWS RDS!

讓我們開始在AWS RDS上創建數據庫!

1- First we open an AWS account.

1-首先,我們開設一個AWS賬戶。

We need to enter the AWS homepage to register with AWS. After entering this page, we proceed by saying create an AWS account. In all steps, we must enter our information and especially the e-mail address correctly. Then we need to enter our payment information. Some services of AWS are free to use if you do not exceed the limits. If you have entered payment information, make sure you do not exceed these limits. AWS charges a $ 1 fee to verify your payment account, then returns it.

我們需要進入AWS主頁以注冊到AWS。 進入此頁面后,我們說創建一個AWS賬戶。 在所有步驟中,我們必須正確輸入我們的信息,尤其是電子郵件地址。 然后,我們需要輸入付款信息。 如果您未超出限制,則可以免費使用 AWS的某些服務。 如果您輸入了付款信息,請確保您沒有超過這些限制。 AWS會收取1美??元的費用來驗證您的付款帳戶,然后將其退回。

For detailed information, you can follow the steps to create an AWS account.

有關詳細信息,您可以按照以下步驟創建AWS賬戶。

2- Let’s enter to RDS and create the Database.

2-讓我們進入RDS并創建數據庫。

After creating an AWS account, we enter RDS.

創建一個AWS賬戶后,我們輸入RDS。

We click on the Databases option on the left side of the console. We take the first step to create DB by saying Create database on the page that opens.

我們單擊控制臺左側的“數據庫”選項。 在打開的頁面上說創建數據庫 ,我們邁出了創建數據庫的第一步。

We need to select the database infrastructure on the page that opens. In this example, we will proceed through MySQL.

我們需要在打開的頁面上選擇數據庫基礎結構。 在此示例中,我們將繼續進行MySQL

For our type of operation, we’re choosing the Free tier for now.

對于我們的操作類型,我們現在選擇“免費”套餐。

We need to determine the database name, user name, and password to be created from the Settings section. I created a db called the experiment for the example and created a user named admincv.

我們需要從“設置”部分確定要創建的數據庫名稱,用戶名和密碼。 我為示例創建了一個名為實驗的數據庫,并創建了一個名為admincv的用戶。

Amazon provides some standard features for the database to be created. If you are doing this study for trial purposes, it would be better not to turn on Storage autoscaling feature in order not to charge. If you use it within the limits set by Amazon, there will be no charge.

Amazon為要創建的數據庫提供了一些標準功能。 如果您出于試用目的進行這項研究,則最好不要打開存儲自動擴展功能以免收費。 如果您在Amazon設置的限制內使用它,則不會收費。

After a little wait, the system will make the database available. It will then appear as “Available” in the Status field.

稍等一會,系統將使數據庫可用。 然后,它將在“狀態”字段中顯示為“ 可用 ”。

Now the database has occurred.

現在數據庫已經出現。

3- Let’s enter the database we created.

3-讓我們輸入我們創建的數據庫。

Here, the endpoint & port information in the Connectivity & Security area is important and it is useful to take note. This information will then be required so that we can access DB from Python.

在此,“連接性和安全性”區域中的端點和端口信息很重要,請注意。 然后將需要此信息,以便我們可以從Python訪問DB。

Now Let’s Switch to Python and Connect to the Database!

現在,讓我們切換到Python并連接到數據庫!

1- We download our libraries.

1-我們下載我們的庫。

import pandas as pd
import pymysql
from sqlalchemy import create_engine

2- We enter our connection information.

2-我們輸入連接信息。

We enter the above endpoint link in the host area. We need to select 3306 as a port. The username is “cvadmin” that we have previously created. The password is that you create for this user to connect. Our DB name was a “deneme”. After assigned this to the database variable, we completed all the operations.

我們在主持人區域中輸入上述端點鏈接。 我們需要選擇3306作為端口。 用戶名是我們先前創建的“ cvadmin”。 密碼是您為該用戶創建的連接密碼。 我們的數據庫名稱是“ deneme”。 將其分配給數據庫變量后,我們完成了所有操作。

host=’deneme.cykgvlpxbgsw.us-east-2.rds.amazonaws.com’
port=int(3306)
user=”cvadmin”
passw=”yourpassw”
database=”deneme”

3- We create an engine by collecting the connection information.

3-我們通過收集連接信息來創建引擎。

Fields such as user, passw in the following code feed on the variables that we created in the previous step.

以下代碼中的諸如user,passw之類的字段以我們在上一步中創建的變量為食。

mydb = create_engine(‘mysql+pymysql://’ + user + ‘:’ + passw + ‘@’ + host + ‘:’ + str(port) + ‘/’ + database , echo=False)

4- We print the data we have on the database.

4-我們打印數據庫中的數據。

We create a table with the name = “hisse” command and we can now print the data we have. stockshistoricdata, a dataframe I have. It gives daily prices of shares in Bist100. You can also use another DF.

我們使用name =“ hisse”命令創建一個表, 現在可以打印已有的數據 。 stockshistoricdata,我有一個數據框。 它給出Bist100中股票的每日價格。 您也可以使用另一個DF。

stockshistoricdata.to_sql(name=”hisse”, con=mydb, if_exists = ‘replace’, index=False)

Let’s check if the data is printed on the table via DBeaver!

讓我們檢查是否通過DBeaver將數據打印在表上!

Our data is now in the “hisse” table.

現在,我們的數據在“ hisse”表中。

Conclusion

結論

Why would you want to press a data in Python to a database on AWS in a data science project? You’re right to ask that question. If you are working with big data, if the data is on a daily or weekly new data, and your python code works for minutes or hours, these situations can be a waste of time.

您為什么要在數據科學項目中將Python中的數據按入AWS上的數據庫? 你問這個問題是對的。 如果您正在使用大數據 ,如果數據是每天或每周的新數據 ,并且您的python代碼工作了幾分鐘或幾小時 ,那么這些情況可能會浪費時間。

To avoid this situation, you create a script in Python, this new data prints this table every day. It does not touch old data. You can connect to the “hisse” table and work on the accumulated data at any time. You can save time and CPU by printing one-day stock data instead of the effort required when creating all data from scratch. In addition, more than one person can work on the same table.

為了避免這種情況,您可以使用Python創建腳本,此新數據每天都會打印此表。 它不涉及舊數據。 您可以隨時連接到“ hisse”表并處理累積的數據。 您可以通過打印一天的庫存數據來節省時間和CPU ,而無需從頭開始創建所有數據。 此外,同一桌子上可以有多個人一起工作。

I hope my writing has been useful. Have a pleasant reading!

希望我的寫作對您有所幫助。 閱讀愉快!

Resources;

資源;

https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Tutorials.WebServerDB.CreateDBIns

https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Tutorials.WebServerDB.CreateDBIns

https://aws.amazon.com/tr/premiumsupport/knowledge-center/create-and-activate-aws-account/?nc1=h_ls

https://aws.amazon.com/tr/premiumsupport/knowledge-center/create-and-activate-aws-account/?nc1=h_ls

My Linkedin Profile;

我的Linkedin個人資料;

https://www.linkedin.com/in/onur-okyol-ba253b72/

https://www.linkedin.com/in/onur-okyol-ba253b72/

翻譯自: https://towardsdatascience.com/using-aws-rds-and-python-together-5718a6878e4c

aws rds同步

總結

以上是生活随笔為你收集整理的aws rds同步_将数据从Python同步到AWS RDS的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。