Answer the question
In order to leave comments, you need to log in
How to combine data from multiple databases when creating a report?
Good day!
When developing a report generation service for an access control system, I encountered a problem.
Its essence is as follows - there are 2 completely separated databases located on different servers:
- DB-1 contains personal information about users (name, list of card UIDs, etc.),
- DB-2 contains events associated with users (the binding goes to the UID of the card).
DB-2 is quite voluminous, it contains tens of thousands of events every day.
When generating a report, I need to link data from both databases, i.e. bind events to specific users (their positions, organizations, etc.) based on the UID of the card contained in each event.
As a result, files with various statistics on attendance, movements, etc. will be generated.
It turns out that if, for example, I want to get statistics on the "Advertising Department" of the Optservice enterprise, then I need to perform operations similar to:
- make a selection of all users related to this enterprise,
- after that I will get a collection of something like {Enterprise, Department, full name, card UID},
- then I need to transfer this collection to a service that will go to DB-2 and extract all events for each card UID for a certain period of time,
- after that, the total data is converted into a convenient view, saved to a file and returned to the user.
But I am very confused by the very operation of selecting from DB-2 ... or a lot of requests or very large requests to be obtained.
I understand that, apparently, there is some kind of intermediate database in which both databases need to be replicated (I don’t know if this is possible ...).
But there are 2 bad points here:
- It is highly undesirable for me to bring all this data together, there are security requirements that the data must be separated on different servers...
- and the second point is the size of this database.
I ask for advice, because I didn’t deal with generating reports and therefore I understand that I’m probably trying to reinvent the wheel.
Answer the question
In order to leave comments, you need to log in
var update = function() {
var val = +$('#f_lr1ro option:selected').val();
var showFirst = [2, 3].indexOf(val) >= 0;
$('#f_lr1rowtd').toggle(showFirst);
};
$(document).ready(function(){
$('#f_lr1ro').change(update);
update();
});
var update = function() {
var val = +$('#f_lr1ro option:selected').val();
var showFirst = [2, 3].indexOf(val) >= 0;
$('#f_lr1rowtd').toggle(showFirst);
};
var update2 = function() {
var val = +$('#f_lr1rowtd option:selected').val();
var showFirst = [3, 4, 5, 6, 7, 8].indexOf(val) >= 0;
var showSecond = [9, 10, 11, 12].indexOf(val) >= 0;
$('#f_lr1rooq').toggle(showFirst);
$('#f_lr1ronq').toggle(showSecond);
};
$(document).ready(function(){
$('#f_lr1ro').change(update);
$('#f_lr1rowtd').change(update2);
update();
update2();
});
the person above has already written, I’ll just add: it’s better to insert the update
function into .ready (if you don’t need it anywhere else)
and check something like $(' #f_lr1ro ') , right in the browser console
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question