Can a BaseX database span multiple folders? - basex

New to BaseX. Working on a project where 100's or sometimes 1000's of XML files are generated each day. Due to other exogenous factors, the preferred file structure would look like:
 blah/20220714/
 blah/20220715/
 etc…
Is there some way to create this database architecture in BaseX?
In the documentation, a single folder seems to be the only option:
“CREATE DB db /path/to/resources will add initial documents to a database”. It seems there is an ‘ADD’ command available to append files to the database; could this theoretically be run each day to append the new folder that gets created?

You can use CREATE DB to create an empty database or a database with an initial set of documents. If you have a fixed set of resources that you want to import, it’s faster to use this bulk import feature than adding the documents in a second step.
With ADD, you can import additional files, directories, remote source, etc. later on, whenever you like.

Related

What is the correct way to update a desktop software after editing its database?

I have a desktop app that is in use by my clients. From time to time I fix some bugs, add features, and push new updates. An update works like this (automatically):
Download new files for the app (Winrar).
Extract the files to a temp folder.
Copy the files to the app folder (overwrite the existing ones).
That's it. I don't touch the Database, which is an MS Access file in its own folder. I just update the files, not the database, because I don't want the clients to lose their data.
Now I've made some schema changes to the database (added some columns, tables...), so I have to update the database file this time as well.
How can I update these database files so the clients won't lose their data?
One option is defining the changes as a series of SQL commands such as ALTER TABLE to run against the database. Put these commands in a special file (or files) and build logic into your updater (or during the launch of your app) to detect and run them.
This has the additional benefit of allowing you to keep these changes with the version control system managing the source code for your app.

What are Access _be and _bp files and how do they link together?

I'm trying to fix and add some functionality to an Access Database that a group I work with uses. They have a FileName.accdb file which holds the queries and forms. The data seems to be stored in one of two other database files FileName_be.accdb and/or FileName_bp.accdb both stored in a 'Back End' Folder beside the FileName.accdb file.
I was hoping someone might be able to explain how all this might link together, there is no documentation on how it was organized.
The other thing that seems odd to me is that 3 files are similar in size:
FileName.accdb = 11MB
FileName_be.accdb = 10.1MB
FileName_bp.accdb file = 7.5MB
The _bp and _be files both only have the database tables, but the _bp file seems to be more up to date.
Your database is split into Frontend and Backend. See e.g.
Microsoft Access Split Database Architecture.
FileName.accdb should have linked tables, queries, forms and code.
FileName_be.accdb sounds like a backend, having only tables.
FileName_bp.accdb - if it's newer, maybe "bp" is "backend production", but that's just a guess.
Open FileName.accdb and open a linked table in design view. In the property sheet, the Description will tell you where the table is linked from. The tooltip in the navigation bar will do so too.
Alternatively, you can use External Data -> Linked Table Manager to re-map these file locations.

Generating several similar SSIS packages (file data source to DB)

Is there a way to automatically generate SSIS packages? I need to create a lot of SSIS packages that just erase data from one table and import data from a text file. The file name matches table name and the column headers are in the first line of the file.
For more detailed information:
I am working on a project in which I have to separate two systems that are currently coupled (one system has direct access to the other's database). After the modifications, one system will provide data through txt files to be loaded in the other database.
We have to use SSIS to load data into the database from the text files.
The text files will be provided in CSV format with column headers in the first line.
The tables from both databases have matching column names, and all we need to do is clear the table and load data from the files.
I have more than one hundred tables with different number of columns. Do I need to create each package manually?
I'm familiar with 2 free options.
EzAPI might be a good place if you're a .NET heavy shop or just really want to geek out with the API. This approach allows you to control the pretty much the entire package generation but at the cost of coding time. I find EzAPI generally easier than working with the base COM/.NET libraries for SSIS.
Biml is an interesting beast. Varigence will be happy to sell you a license to Mist but it's not needed. All you would need is BIDSHelper and then browse through BimlScript and look for a recipe that approximates your needs. Once you have that, click the context sensitive menu button in BIDSHelper and whoosh, it generates packages.
I did this just using vb, I passed in the table names as a command parameter and used vb to generate the insert and clear, worked a charm... I can try and dig it out tomorrow when I'm back in the office but it was pretty simple. There didn't seem to be any other way to say "just get x and export it", "just take y and import it into z" so vb it had to be. In fact come to think of it I think I actually used a small xml file to pass the table info for export and then determined the table name for import from the csv file name. To be clear, this was only one package but it could dynamically choose the number of imports/exports it did. Further clarification this was vb within ssis as a processing step

Can I read AND write to a db in my main bundle using core data?

With the particular app I am working on, I have a significant amount of data that I need to have in my db so I can read it in. I also have the need to write a few things to the db. I took a copy of the sqlite db out of the documents folder and put it into my main bundle and can read my manually inserted data without problems.
I am now trying to insert data, but I am running into difficulty. I remember reading somewhere that you can't write to a db in the main bundle? Only the documents folder? Is that correct? What are my options if I need to have custom data in a core data db that I also need write to?
Should I move it out of the main into the documents folder?
Thanks!
I can't find documentation to back this up, but it is my understanding that the application bundle is read-only. I have read that if you have a pre-populated Core Data store in the app bundle, you need to copy it to the Documents directory - and then make modifications that copy.
Check out this.

Export queries from SSMS to files - not the results but the query

I want to export all my queries as individual files for purposes of putting them into mercurial source control, but I don't know how to export the individual queries as individual files without having to open each one, then save to the folder, then add into the project, or some equally convoluted process.
I wouldn't mind having to add each one individually, but how do I get them out of the database as individual files without opening them all and doing each one save as? Ostensibly I would like them named with the name they have in the database right now.
I could easily dump the whole lot into one long file using database tasks, but that's not really super helpful is it?
I have SSMS 2k5 and 2k8 (and VS 2k5, 2k8, 2010 to boot) to work with, any thoughts?
Right click on the database. Select Generate Script. On the last page. Script To file you can choose single file or file per object
When you script a database in SSMS you have the option of one file per objects.
SMO is useful with a small app to iterate through
Third party tools like Red Gate SQL Compare (there are other free tools) can script too
I would write a small C# program which extracts your database object via SMO and stores them in your filesystem the way you want.
It is rather easy to write stored procedures which fetches the definition into the result as text. sp_helptext could be used as start.
Than you can use PowerShell to write the Output to the file system.
It sounds as if this would fit rather good into the Really Simple Data Dictionary codeplex project. link text

Resources