Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
softwares:giocoso:dbmenu:importdb [2025/11/22 12:07] hjrsoftwares:giocoso:dbmenu:importdb [2025/11/22 12:20] (current) hjr
Line 1: Line 1:
-====== Import Plays To A Database ====== +====== Import Plays To A Local Database ====== 
-Suppose you created a database called 'renaissance' and a separate database called 'post-renaissance', thinking that keeping the two separate would be useful. Each database thus has its own set of recordings and its own play history. One day, you decide it's pointless keeping the two databases separate in this way, so you create a brand new database called 'classical music'. You get the new database to scan a folder that contains within it both your renaissance and post-renaissance music files. No problem: you now have a single database that contains a RECORDINGS table of <em>both</em> sets of music, created from scratch. But what about the two sets of play histories? How do you port those across to the new database?+Suppose you created a database called 'renaissance' and a separate database called 'post-renaissance', thinking that keeping the two separate would be useful. Each database thus has its own set of recordings and its own play history. One day, you decide it's pointless keeping the two databases separate in this way, so you create a brand new database called 'classical music'. You get the new database to scan a folder that contains within it both your renaissance and post-renaissance music files. No problem: you now have a new database that contains a single **RECORDINGS** table containing //both/sets of music, created from scratch. 
  
-This is where the Database Management menu Option 5 comes in handy. You use it to 'point' to a 'source' database and Giocoso will extract the plays out of the source and write them into a second database you 'point' to, the 'destination' database's play history table. You can do that as many times as you like, using different source databases: the plays fetched into the destination database are <em>added</em> to the plays already stored there. So, by running Option 5, pointing to 'renaissance', the plays are pulled into 'classical music'. Run Option 5 again and this time point to 'post-renaissance': the 'classical music' database now contains plays from <em>both</em> source databases: the two original databases have effectively now been merged into one.+Of course: the new database will not have any **play history** associated with it -and you surely don't want to lose the play history you built up when the two databases were separate entities! So, how do you port those separate play histories to the new database? 
 + 
 +This is where the **Database Management** menu **Option 5** comes in handy. You use it to 'point' to a 'source' database and Giocoso will extract the plays out of the source and write them into a second database you 'point' to, the 'destination' database's play history table. You can do that as many times as you like, using different source databases: the plays fetched into the destination database are //added/to the plays already stored there. So, by running Option 5, pointing to 'renaissance', the plays are pulled into 'classical music'. Run Option 5 again and this time point to 'post-renaissance': the 'classical music' database now contains plays from **both** source databases: the two original databases have effectively now been merged into one (though they remain as separate databases on disk: you can delete them yourself at some time of your choosing).
  
 Here's a worked example. I start with two databases, one called 'main' and one called 'main Classical database'. Here is the aggregate statistics report for main: Here's a worked example. I start with two databases, one called 'main' and one called 'main Classical database'. Here is the aggregate statistics report for main:
  
-<a href="http://absolutelybaching.com:81/wp-content/uploads/2023/11/Screenshot_20231105_183702.png"><img class="aligncenter size-medium wp-image-24595" src="http://absolutelybaching.com:81/wp-content/uploads/2023/11/Screenshot_20231105_183702-650x225.png" alt="" width="650" height="225" /></a>+{{ :software:giocoso:screenshot_20231105_183702.png?direct&650 |}}
  
 That's a database with data concerning recordings by 603 composers, 13 of which have been played. Now here is the aggregate statistics report for 'main Classical database': That's a database with data concerning recordings by 603 composers, 13 of which have been played. Now here is the aggregate statistics report for 'main Classical database':
  
-<a href="http://absolutelybaching.com:81/wp-content/uploads/2023/11/Screenshot_20231105_184348.png"><img class="aligncenter size-medium wp-image-24596" src="http://absolutelybaching.com:81/wp-content/uploads/2023/11/Screenshot_20231105_184348-650x225.png" alt="" width="650" height="225" /></a>+{{ :software:giocoso:screenshot_20231105_184348.png?direct&650 |}}
  
 So that's a database with only a single composer's work represented in its database, and with just 5 of those recordings having been played. So that's a database with only a single composer's work represented in its database, and with just 5 of those recordings having been played.
Line 18: Line 20:
 So, first I create a blank database: for speed, I'll point Giocoso at a folder containing just a single recording for now. Immediately after creation, therefore, this new database's aggregate statistics are: So, first I create a blank database: for speed, I'll point Giocoso at a folder containing just a single recording for now. Immediately after creation, therefore, this new database's aggregate statistics are:
  
-<a href="http://absolutelybaching.com:81/wp-content/uploads/2023/11/Screenshot_20231105_184633.png"><img class="aligncenter size-medium wp-image-24598" src="http://absolutelybaching.com:81/wp-content/uploads/2023/11/Screenshot_20231105_184633-650x225.png" alt="" width="650" height="225" /></a>+{{ :software:giocoso:screenshot_20231105_184633.png?direct&650 |}}
  
 So, a new database containing just 1 recording by 1 composer ...and zero plays. We are starting with a very blank slate, in other words! So, a new database containing just 1 recording by 1 composer ...and zero plays. We are starting with a very blank slate, in other words!
Line 24: Line 26:
 So now I take Database Management menu Option 5: So now I take Database Management menu Option 5:
  
-<a href="http://absolutelybaching.com:81/wp-content/uploads/2023/11/Screenshot_20231105_184904.png"><img class="aligncenter size-medium wp-image-24599" src="http://absolutelybaching.com:81/wp-content/uploads/2023/11/Screenshot_20231105_184904-650x225.png" alt="" width="650" height="225" /></a>+{{ :software:giocoso:screenshot_20231105_184904.png?direct&650 |}}
  
-You are first directed to pick a <strong>source</strong> database. In my case, that's going to be 'main':+You are first directed to pick a **source** database. In my case, that's going to be 'main':
  
-<a href="http://absolutelybaching.com:81/wp-content/uploads/2023/11/Screenshot_20231105_185004.png"><img class="aligncenter size-medium wp-image-24600" src="http://absolutelybaching.com:81/wp-content/uploads/2023/11/Screenshot_20231105_185004-650x352.png" alt="" width="650" height="352" /></a>+{{ :software:giocoso:screenshot_20231105_185004.png?direct&650 |}}
  
 The program now displays all .db files it has found in $HOME/.local/share/giocoso3/db: your job is to use the up- and down-arrows to highlight the required source database and to press the Space Bar when it's highlighted in order to select it. You can only select one source at a time. An asterisk appears in the brackets next to the selected database name. Press [Enter] to proceed: The program now displays all .db files it has found in $HOME/.local/share/giocoso3/db: your job is to use the up- and down-arrows to highlight the required source database and to press the Space Bar when it's highlighted in order to select it. You can only select one source at a time. An asterisk appears in the brackets next to the selected database name. Press [Enter] to proceed:
  
-<a href="http://absolutelybaching.com:81/wp-content/uploads/2023/11/Screenshot_20231105_185152.png"><img class="aligncenter size-medium wp-image-24601" src="http://absolutelybaching.com:81/wp-content/uploads/2023/11/Screenshot_20231105_185152-650x352.png" alt="" width="650" height="352" /></a>+{{ :software:giocoso:screenshot_20231105_185152.png?direct&650 |}}
  
-You are now instructed to select the <em>destination</em> database: the one into which the source's plays will be piped. Note that you can select any database to be the destination: it doesn't have to be the one currently in-use by the main Giocoso program. As before:+You are now instructed to select the **destination** database: the one into which the source's plays will be piped. Note that you can select any database to be the destination: it doesn't have to be the one currently in-use by the main Giocoso program. As before:
  
-<a href="http://absolutelybaching.com:81/wp-content/uploads/2023/11/Screenshot_20231105_185340.png"><img class="aligncenter size-medium wp-image-24602" src="http://absolutelybaching.com:81/wp-content/uploads/2023/11/Screenshot_20231105_185340-650x352.png" alt="" width="650" height="352" /></a>+{{ :software:giocoso:screenshot_20231105_185340.png?direct&650 |}}
  
 ...you are presented with a list of all possible databases. You just up- and down-arrow to highlight one and press the Space Bar to select it. In this case, I'm wanting main's plays to be ported across to the 'newclassical' database. Press [Enter] to confirm your selection: ...you are presented with a list of all possible databases. You just up- and down-arrow to highlight one and press the Space Bar to select it. In this case, I'm wanting main's plays to be ported across to the 'newclassical' database. Press [Enter] to confirm your selection:
  
-<a href="http://absolutelybaching.com:81/wp-content/uploads/2023/11/Screenshot_20231105_185504.png"><img class="aligncenter size-medium wp-image-24603" src="http://absolutelybaching.com:81/wp-content/uploads/2023/11/Screenshot_20231105_185504-650x352.png" alt="" width="650" height="352" /></a>+{{ :software:giocoso:screenshot_20231105_185504.png?direct&650 |}}
  
-A confirmation is given that the source has <em></em>number of plays and that those will be ported across to the newclassical database. You can back out at this point if you prefer: note that 'No' is the default option selected. Were you to just reflexively press [Enter] here, therefore, the import process would end with no harm being done to either database. But I <em>do</em> want to proceed, so I left-arrow to get the 'Yes' option highlighted and only then press [Enter]:+A confirmation is given that the source has //X/number of plays and that those will be ported across to the newclassical database. You can back out at this point if you prefer: note that 'No' is the default option selected. Were you to just reflexively press [Enter] here, therefore, the import process would end with no harm being done to either database. But I //do/want to proceed, so I left-arrow to get the 'Yes' option highlighted and only then press [Enter]:
  
-<a href="http://absolutelybaching.com:81/wp-content/uploads/2023/11/Screenshot_20231105_185707.png"><img class="aligncenter size-medium wp-image-24604" src="http://absolutelybaching.com:81/wp-content/uploads/2023/11/Screenshot_20231105_185707-650x352.png" alt="" width="650" height="352" /></a>+{{ :software:giocoso:screenshot_20231105_185707.png?direct&650 |}}
  
 A confirmation message appears: just press [Enter] again to dismiss it. Now, all I have to do is repeat the entire process, just remembering to pick 'main Classical database' as my source database, whilst also remembering to pick 'newclassical' as the destination (as before). This time, I see this: A confirmation message appears: just press [Enter] again to dismiss it. Now, all I have to do is repeat the entire process, just remembering to pick 'main Classical database' as my source database, whilst also remembering to pick 'newclassical' as the destination (as before). This time, I see this:
  
-<a href="http://absolutelybaching.com:81/wp-content/uploads/2023/11/Screenshot_20231105_185759.png"><img class="aligncenter size-medium wp-image-24605" src="http://absolutelybaching.com:81/wp-content/uploads/2023/11/Screenshot_20231105_185759-650x352.png" alt="" width="650" height="352" /></a>+{{ :software:giocoso:screenshot_20231105_185759.png?direct&650 |}}
  
 At this point, I can select the Reporting menu, Option 1 once more: At this point, I can select the Reporting menu, Option 1 once more:
  
-<a href="http://absolutelybaching.com:81/wp-content/uploads/2023/11/Screenshot_20231105_185935.png"><img class="aligncenter size-medium wp-image-24606" src="http://absolutelybaching.com:81/wp-content/uploads/2023/11/Screenshot_20231105_185935-650x250.png" alt="" width="650" height="250" /></a>+{{ :software:giocoso:screenshot_20231105_185935.png?direct&650 |}}
  
 The newclassical database is now said to contain 1 composer's music as before and only 1 recording... but 18 plays. The plays from the two source databases have been migrated to the new database, just as intended. The newclassical database is now said to contain 1 composer's music as before and only 1 recording... but 18 plays. The plays from the two source databases have been migrated to the new database, just as intended.
  
-I should point out that if you merely want to move an entire database from one PC to another (for example), the simpler procedure is literally to copy the .db file, physically, from one hard disk to another. Physically copying a database in this way moves both the RECORDINGS <em>and</em> the PLAYS tables from one device to another: there is no need in this case to extract the plays and handle them in this special way. Remember, too, that the RECORDINGS table can always be re-constructed from scratch, just by performing a new Full Scan (Option 3) and pointing Giocoso at your music collection's hard disk folders afresh. It is therefore only when you need to preserve <em>just </em>the PLAYS table in a database that this 'Import plays to a database' functionality makes any sense -and that's usually going to be because you wish to merge the plays from multiple prior databases, as I've described here.+I should point out that if you merely want to move an entire database from one PC to another (for example), the simpler procedure is literally to copy the .db file, physically, from one hard disk to another. Physically copying a database in this way moves both the RECORDINGS //and/the PLAYS tables from one device to another: there is no need in this case to extract the plays and handle them in this special way. Remember, too, that the RECORDINGS table can always be re-constructed from scratch, just by performing a new Full Scan (Option 3) and pointing Giocoso at your music collection's hard disk folders afresh. It is therefore only when you need to preserve //just/the PLAYS table in a database that this 'Import plays to a database' functionality makes any sense -and that's usually going to be because you wish to merge the plays from multiple prior databases, as I've described here
 + 
 +Note that an import doesn't //delete// anything in the destination PLAYS table before running. Imports are therefore cumulative -and there's nothing to stop you importing and re-importing from the same source database multiple times, if you are of a mind so to do.
  
-Notefinally: an import doesn't <em>delete</em> anything in the destination PLAYS table before running. Imports are therefore cumulative -and there's nothing to stop you importing and re-importing from the same source database multiple timesif you are of a mind so to do. +Finallynote that this option **only** works on the //local// music database. If you've switched on the Giocoso Pro features to enable working with a remote, shared music database, this import option will have zero effect on that remote database. You will need to use the **Pro** menu, **Option 2** to push a local PLAYS table to a remote pro database: you could push the plays from two or more local databases to the remoteshared database to achieve the same sort of 'merging' of databases in the pro 'context'.
-</span>+
  
 ---- ----
  • softwares/giocoso/dbmenu/importdb.txt
  • Last modified: 2025/11/22 12:20
  • by hjr