You can download some data from here.
Unzip the files into your data directory. The GPDataYYYYMM.csv files are the ones you want.
This assumes you have mariadb installed and all working OK.
Unfortunately the structure of the csv files changes between 2013 to 2015 has one set of columns and 2016 onward have another set.
as per Blue Peter I’ve created a database called pharmacy before hand.
create table pharmacy.GPData_OLD ( HB text null, Locality text null, PracticeID text null, BNFCode text null, BNFName text null, Items int null, NIC double null, ActCost double null, Quantity int null, Period int null );
The new structure has a couple of extra columns: DDD and ADQ.
create table pharmacy.GPData_NEW ( HB text null, Locality text null, PracticeID text null, BNFCode text null, BNFName text null, Items int null, NIC double null, ActCost double null, Quantity int null, DDD double null, ADQ double null, Period int null );
Now we’ve created the tables we can use a bash script to load all the csv files into the tables we’ve just knocked up.
This from something pulled from Stack Overflow:
for f in /DATA/mysql/pharmacy/GPData201[345]*.csv do mysql -e "LOAD DATA INFILE '"$f"' INTO TABLE GPData_OLD FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' IGNORE 1 LINES" -u root --password="yourrootpassword" pharmacy echo "Done: '"$f"' at $(date)" done
save it as something called “something” and then run it by invoking like ./something. Remember chmod u+x something
for f in /DATA/mysql/pharmacy/GPData201[67]*.csv do mysql -e "LOAD DATA INFILE '"$f"' INTO TABLE GPData201706 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' IGNORE 1 LINES" -u root --password="TreeOfLife123$" pharmacy echo "Done: '"$f"' at $(date)" done
as something like “something2016” invoking with ./something2016 again make it run-able using chmod u+x something2016
Chug chug chug and you get something like 33 million rows.