Compare commits

...
Author SHA1 Message Date
viniciusgadea 4543c1ad05 FIX: enhance getTableMetadata to filter columns by allowed data types 2026-09-03 12:19:08 -03:00
Rafael Santana ec39b82843 Merge pull request #518 from dadosfera/feature/cdc-connector
FIX: CDC live status decodes int64 offsets as numbers
2026-08-31 17:07:20 -03:00
RafaelandWOZCODE 20d3532c0f FIX: address review round 2 on the CDC refactor
- toCdcTable accepts the source table named either table_name (platform
  bodies) or name (create DTO), so call sites pass it point-free:
  body.tables.map(toCdcTable). The identity is still derived in one place.
- PipelineTablesService declares its logger like every other maestro service
  (logger: DadosferaLogger assigned from the injected instance).

Co-Authored-By: WOZCODE <contact@withwoz.com>
2026-08-31 16:09:25 -03:00
Rafael Santana 9457fcc85e Merge pull request #519 from dadosfera/refactor/cdc-review
UPDATE: apply the CDC code-review policy (maestro #510)
2026-08-31 12:52:51 -03:00
Rafael Santana 1400df0ab9 Merge pull request #510 from dadosfera/feature/cdc-connector
Feature/cdc connector
2026-08-28 13:36:54 -03:00
4 changed files with 35 additions and 14 deletions
@@ -213,6 +213,20 @@ export class ConnectionTestService {
body: GetTableMetadataReq,
user: RequestUser,
): Promise<GetTableMetadataRes> {
// Columns eligible as the incremental reference field are the ones whose
// data type is allowed for this engine (e.g. int/date/timestamp). The
// allowlist is owned by the platform API, keyed by engine === plugin.
const allowedByEngine = await this.platformApiService
.proxy('GET', '/jobs/jdbc/configs/allowed_datatypes', user)
.catch(() => null);
const allowedDataTypes: string[] =
allowedByEngine?.allowed_datatypes?.find(
(datatypes) => datatypes.engine === body.plugin,
)?.allowed_datatypes ?? [];
const allowedSet = new Set(
allowedDataTypes.map((type) => type.toLowerCase()),
);
const tables_metadata = await Promise.all(
body.table_list.map(async (table_name) => {
const result = await this.connectionsApiService.proxy(
@@ -222,14 +236,18 @@ export class ConnectionTestService {
`/tables/${encodeURIComponent(table_name)}/columns`,
user,
);
const columns = result.columns.map((column) => ({
name: column.column_name,
type: column.data_type,
is_primary_key: column.is_primary_key,
}));
const references = columns.filter((column) =>
allowedSet.has(String(column.type).toLowerCase()),
);
return {
table_name,
columns: result.columns.map((column) => ({
name: column.column_name,
type: column.data_type,
is_primary_key: column.is_primary_key,
})),
references: [],
columns,
references,
};
}),
);
+9 -4
View File
@@ -3,11 +3,15 @@ import {
CdcTable,
} from '@dadosfera/protospack-v2/dist/lib/Input/interfaces/entities';
/** What a caller knows about a CDC table before it is stored. */
/** What a caller knows about a CDC table before it is stored. The source
* table is named `table_name` on the platform-facing bodies and `name` on
* the create DTO (CdcTableReq); either works — deriving one from the other
* happens only here. */
export interface CdcTableInput {
// Optional on the create DTO (CdcTableReq); the platform validates it.
table_schema?: string;
table_name: string;
table_name?: string;
name?: string;
primary_keys?: string[];
iceberg_table_name?: string;
iceberg_qualify_table_name?: string;
@@ -25,10 +29,11 @@ export interface CdcTableInput {
* `name ?? table_name`).
*/
export function toCdcTable(table: CdcTableInput): CdcTable {
const tableName = table.table_name ?? table.name;
return {
table_schema: table.table_schema,
table_name: table.table_name,
name: table.table_name,
table_name: tableName,
name: tableName,
primary_keys: table.primary_keys ?? [],
iceberg_table_name: table.iceberg_table_name,
iceberg_qualify_table_name: table.iceberg_qualify_table_name,
+1 -3
View File
@@ -196,9 +196,7 @@ export class InputsService {
name: body.name,
plugin: body.plugin,
read_only: body.read_only ?? true,
tables: body.tables.map((t) =>
toCdcTable({ ...t, table_name: t.name }),
),
tables: body.tables.map(toCdcTable),
destination: body.destination,
},
info,
@@ -30,7 +30,7 @@ interface PlatformPipeline {
*/
@Injectable()
export class PipelineTablesService {
private logger: DadosferaLogger['logger'];
logger: DadosferaLogger;
constructor(
private readonly platformApiService: PlatformApiService,