Skip to content

Commit

Permalink
SDA-80 Limitar el número de tablas en un datasource
Browse files Browse the repository at this point in the history
  • Loading branch information
jortilles committed Jul 28, 2023
1 parent c8b6927 commit bd1a728
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export class BigQueryConnection extends AbstractConnection {
}

for (let i = 0; i < tableNames.length; i++) {

let new_table = await this.setTable(tableNames[i]);
let count = 0;
if (optimize === 1) {
Expand All @@ -63,6 +64,10 @@ export class BigQueryConnection extends AbstractConnection {
}
new_table.tableCount = count;
tables.push(new_table);
if(i> 500){
console.log('Un datasource no puede tener más de 500 tablas ');
i = tableNames.length + 1;
}
}

for (let i = 0; i < tables.length; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,9 @@ export class MysqlConnection extends AbstractConnection {

this.client = await this.getclient();
const foreignKeys = await this.execQuery(fkQuery);

this.client = await this.getclient();
this.client.query = util.promisify(this.client.query);
for (let i = 0; i < tableNames.length; i++) {

let new_table = await this.setTable(tableNames[i]);
let count = 0;
if(optimize === 1){
Expand All @@ -96,8 +94,11 @@ export class MysqlConnection extends AbstractConnection {
}
new_table.tableCount = count;
tables.push(new_table);
if(i> 500){
console.log('Un datasource no puede tener más de 500 tablas ');
i = tableNames.length + 1;
}
}

for (let i = 0; i < tables.length; i++) {
for (let j = 0; j < tables[i].columns.length; j++) {
tables[i].columns[j] = this.setColumns(tables[i].columns[j], tables[i].tableCount);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ export class OracleConnection extends AbstractConnection {
}
new_table.tableCount = count;
tables.push(new_table);
if(i> 500){
console.log('Un datasource no puede tener más de 500 tablas ');
i = tableNames.length + 1;
}
}

for (let i = 0; i < tables.length; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ export class PgConnection extends AbstractConnection {
}
new_table.tableCount = count;
tables.push(new_table);
if(i> 500){
console.log('Un datasource no puede tener más de 500 tablas ');
i = tableNames.length + 1;
}
}
/**Set columns */
for (let i = 0; i < tables.length; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export class SQLserverConnection extends AbstractConnection {
});

for (let i = 0; i < tableNames.length; i++) {

let new_table = await this.setTable(tableNames[i]);
let count = 0;
if (optimize === 1) {
Expand All @@ -98,6 +99,10 @@ export class SQLserverConnection extends AbstractConnection {
}
new_table.tableCount = count;
tables.push(new_table);
if(i> 500){
console.log('Un datasource no puede tener más de 500 tablas ');
i = tableNames.length + 1;
}
}

for (let i = 0; i < tables.length; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,14 @@ export class SnowflakeConnection extends AbstractConnection {

/**set tables */
for (let i = 0; i < tableNames.length; i++) {

let newTable: any = await this.setTable(tableNames[i].name);
newTable.tableCount = tableNames[i].count;
tables.push(newTable)
tables.push(newTable);
if(i> 500){
console.log('Un datasource no puede tener más de 500 tablas ');
i = tableNames.length + 1;
}
}

/**Set columns */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ export class VerticaConnection extends AbstractConnection {
}
new_table.tableCount = count;
tables.push(new_table);
if(i> 500){
console.log('Un datasource no puede tener más de 500 tablas ');
i = tableNames.length + 1;
}
}

for (let i = 0; i < tables.length; i++) {
Expand Down

0 comments on commit bd1a728

Please sign in to comment.