Python Forum
merge 3 sql data sets to 1 librairy
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
merge 3 sql data sets to 1 librairy
#1
Hi,

I'm new to Python and I have a problem with list, librairies,...
I have 3 MySQL datasets that I want to merge to 1 librairy. I've tried everything but I can't see the Woods from the trees anymore. I'm sure that for an experienced program this is a very easy problem. Can somebody help me please.

#read iD,tagname and StationID from EWon
db_tagid =  con.cursor()
db_tagid.execute("SELECT Id FROM esync_tags")
df_tagid = db_tagid.fetchall()

db_tagname =  con.cursor()
db_tagname.execute("SELECT Name FROM esync_tags")
df_tagname = db_tagname.fetchall()

db_ewonstationid =  con.cursor()
db_ewonstationid.execute("SELECT StationID FROM esync_tags")
df_ewonstationid = db_ewonstationid.fetchall()
I want to merge this so the librairy looks like this:

all_options = { 
    'ewonstationid1': { 
    'tagname1': tagid1, 
    'tagname2': tagid2, 
    }, 
    'ewonstationid2': { 
    'tagname3': tagid3, 
    'tagname4': tagid4, 
    } 
} 

Sorry, I mean dictionairy, not librairy
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Peculiar pattern from printing of sets SahandJ 7 1,594 Dec-29-2021, 06:31 PM
Last Post: bowlofred
  How does one combine 2 data sets ? detlefschmitt 2 1,657 Sep-03-2021, 03:38 AM
Last Post: detlefschmitt
  Data merge error rr1997 0 1,880 Mar-24-2021, 03:25 PM
Last Post: rr1997
  Looping Through Large Data Sets JoeDainton123 10 4,278 Oct-18-2020, 02:58 PM
Last Post: buran
  comprehension for sets Skaperen 2 1,832 Aug-07-2020, 10:12 PM
Last Post: Skaperen
  Merge CSV Column using Pandas Data Frames davidlang 1 2,587 May-01-2020, 02:43 PM
Last Post: klllmmm
  How to read multiple csv files and merge data rajeshE 0 1,919 Mar-28-2020, 04:01 PM
Last Post: rajeshE
  Sort sets by item values Sergey 4 59,374 Apr-19-2019, 10:50 AM
Last Post: Sergey
  Problem with character sets Pedroski55 4 3,652 Mar-04-2019, 02:35 AM
Last Post: snippsat
  Sets and Lists mp3909 2 2,394 Feb-21-2018, 11:54 AM
Last Post: mp3909

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020