Any way to merge .sqlite files?

Hey, I've been playing on a server for some time, then I changed server name on my multiplayer servers list and I didn't realize it abandoned previous files and started generating new LODs :BRUH: is there a way I can merge two .sqlite files with already explored terrains into one file?
8 Replies
Miki_P98
Miki_P984mo ago
Yes E.g - You can open the 2 DB files in python - Select all LODs from one - Insert if not exists to the second one Google Python SQLite and SQL w3school
?
?OP4mo ago
Uh, I know nothing about Python but I used to create applications in C#, is that possible to do in C# ? Or C++ ?
majo24
majo244mo ago
Yea, there are sqlite libraries for almost every language
Miki_P98
Miki_P984mo ago
For sure, but knowing C++ it will be much much harder
?
?OP4mo ago
Give me some time, I am trying on some C# solution :Loading:
command.CommandText = "select * from DistantHorizons"; // no such table as "DistantHorizons"
command.CommandText = "select * from DistantHorizons"; // no such table as "DistantHorizons"
Thank you @majo24@Miki_P98 I am close to create something in C# but I don't know much about SQL, how can I know what's the table name? I get exception errors because no such table exists and I dunno what are table names in the .sqlite file
majo24
majo244mo ago
You can use a DB Viewer to take a closer look at the Databases, but the table you wanna target is named FullData iirc
?
?OP4mo ago
using System;
using Microsoft.Data.Sqlite;

namespace merge_databases
{
internal class Program
{
static void Main()
{
using SqliteConnection //oldDb = new(@"Data Source=C:\Users\0x3F\AppData\Roaming\.minecraft\Distant_Horizons_server_data\MERGE_OLD\overworld\DistantHorizons.sqlite"),
newDb = new(@"Data Source=C:\Users\0x3F\AppData\Roaming\.minecraft\Distant_Horizons_server_data\MERGE_NEW\overworld\DistantHorizons.sqlite");
//oldDb.Open();
newDb.Open();

SqliteCommand command = newDb.CreateCommand();
command.CommandText = "SELECT * FROM FullData";

using SqliteDataReader reader = command.ExecuteReader();

while(reader.Read())
{
Console.Write(reader.GetString(0));
}

Console.ReadKey();
}
}
}
using System;
using Microsoft.Data.Sqlite;

namespace merge_databases
{
internal class Program
{
static void Main()
{
using SqliteConnection //oldDb = new(@"Data Source=C:\Users\0x3F\AppData\Roaming\.minecraft\Distant_Horizons_server_data\MERGE_OLD\overworld\DistantHorizons.sqlite"),
newDb = new(@"Data Source=C:\Users\0x3F\AppData\Roaming\.minecraft\Distant_Horizons_server_data\MERGE_NEW\overworld\DistantHorizons.sqlite");
//oldDb.Open();
newDb.Open();

SqliteCommand command = newDb.CreateCommand();
command.CommandText = "SELECT * FROM FullData";

using SqliteDataReader reader = command.ExecuteReader();

while(reader.Read())
{
Console.Write(reader.GetString(0));
}

Console.ReadKey();
}
}
}
Okay, well... I was able to open the database and read some data but I get hundreds of "random" digits I have no idea what to do with... I think it'd be easier if I'll just re-explore the terrain I explored after renaming the server, it would be a 20-30 mins hustle but I have a feeling programming a merging tool would take me days... So I think it's possible but not worth efforts in my case, anyway, thank you a lot for your assistance! @majo24 Unfortunately I don't see a "Unsolved" or "Not resolved" tag to mark this post as unresolved
BackSun
BackSun4mo ago
I don't have the time today but I was able to get screenshots of most of the steps (right up to inserting the Data from table 1 into table 2). You can do it all via DB Browser, you don't need to write any custom programs or anything.
Want results from more Discord servers?
Add your server