I Need To Compare Data From SQL And From Selemium Parser Point Is If i get new Values From Selenium insert those values into SQL update existing values They Look Like This
Outcome From Parser
ds
FIELD1 | date | Price | id |
---|---|---|---|
0 | Thu Apr 29 10:01 EDT | $2.07 | 73e14f90-f482-4757-9ddb-494e2b9041b7 |
1 | Thu Apr 29 10:01 EDT | $2.06 | 1cf6102a-7b3c-4318-8b9e-77f3b8e32af1 |
2 | Thu Apr 29 10:01 EDT | $2.07 | a72c8d39-2930-4ecd-a77b-785da6712b24 |
3 | Thu Apr 29 10:30 EDT | $2.25 | b4e0e9ef-dbe1-407c-8584-b3998c915dde |
4 | Thu Apr 29 10:46 EDT | $2.34 | 95c3db89-c1c7-423a-8fdb-21ecf55e0bf1 |
5 | Thu Apr 29 09:30 PDT | $2.52 | 8123054b-e9c9-4785-a071-67bcc20b8b96 |
6 | Thu Apr 29 11:45 MDT | $2.57 | 62decf1f-ebda-47ff-bedb-67e3b88c3c57 |
7 | Thu Apr 29 11:30 PDT | $2.63 | a1116a78-f2b5-470c-a09d-7663b52472f5 |
8 | Thu Apr 29 14:28 PDT | $2.02 | f6c7c815-c045-41a3-a0a4-0e15b1a60e57 |
9 | Thu Apr 29 18:00 EDT | $2.36 | 479b0f16-0688-4ceb-aedd-9bb61d8fa781 |
10 | Thu Apr 29 18:00 PDT | $2.44 | f20addf7-0243-487e-9943-fe2dc8bfab2b |
11 | Thu May 6 18:30 PDT | $2.11 | 40c70728-7da4-481f-bfc9-96648e10eab1 |
12 | Fri May 7 18:30 PDT | $3.00 | e1b648fa-38ef-4f22-9a7b-0f79abdaa769 |
13 | Sat May 8 17:30 PDT | $2.11 | fc8d61b1-692f-4c7c-9128-ba98e24564de |
14 | Sat May 8 18:00 PDT | $2.00 | b9e20c68-f72c-44e7-8c5a-fe3acee664fa |
Data In SQL
df
FIELD1 | date | Price | id |
---|---|---|---|
1 | Thu Apr 29 19:00 PDT | $2.06 | e9c20a97-5cd9-4702-94a2-14865604100b |
2 | Thu Apr 29 19:00 PDT | $2.83 | 001b3c03-87b6-4e2b-807d-fcb94dda1368 |
3 | Thu Apr 29 19:00 PDT | $2.44 | 6a97651b-7f9b-4c48-ba77-97319e34e5b1 |
4 | Fri Apr 30 02:30 PDT | $2.20 | dd14367d-7282-4230-92c1-3bcde778d391 |
5 | Fri Apr 30 04:45 PDT | $2.31 | 3602df69-a4ff-466e-af07-5f812c32d792 |
6 | Fri Apr 30 11:45 MDT | $2.07 | 0e28cb3d-8b6e-4a7e-8658-0203292ee92a |
7 | Sun May 2 01:45 MDT | $2.06 | 423dfd39-ba13-4742-b856-d9dab2874f6b |
8 | Sun May 2 01:45 MDT | $2.08 | bd112d74-1410-40bc-aa9e-f39773703d5d |
9 | Tue May 4 18:30 PDT | $2.11 | 6be45a63-be2c-4391-ad33-ce7d95009719 |
10 | Thu May 6 18:00 PDT | $2.11 | b1e6c047-793f-4e35-9854-f4df0ed975c6 |
11 | Thu May 6 18:30 PDT | $2.11 | 40c70728-7da4-481f-bfc9-96648e10eab1 |
12 | Fri May 7 18:30 PDT | $2.11 | e1b648fa-38ef-4f22-9a7b-0f79abdaa769 |
13 | Sat May 8 17:30 PDT | $2.11 | fc8d61b1-692f-4c7c-9128-ba98e24564de |
14 | Sat May 8 18:00 PDT | $2.11 | b9e20c68-f72c-44e7-8c5a-fe3acee664fa |
How Can I Caompare Those Datasets And If There Is New Values In Parser Write Row With These id and if not update existing values
I thought
ds = pd.Dataframe(parser)
df = pd.Dataframe(sql)
for i in ds['id']:
if i in df['id']
df.append(i)
else:
df.insert(row index to insert specific row)
The Id unique and will remain same, but price and date can Change, how i can update SQL values if values changed in parser without overwriting it, and append or insert specific values to PostgresSQL from parser
Aucun commentaire:
Enregistrer un commentaire