use of com.netflix.metacat.connector.s3.model.Table in project metacat by Netflix.
the class TableDaoImpl method getBySourceDatabaseTableName.
@Override
public Table getBySourceDatabaseTableName(final String sourceName, final String databaseName, final String tableName) {
Table result = null;
final List<Table> tables = getBySourceDatabaseTableNames(sourceName, databaseName, Lists.newArrayList(tableName));
if (!tables.isEmpty()) {
result = tables.get(0);
}
return result;
}
use of com.netflix.metacat.connector.s3.model.Table in project metacat by Netflix.
the class S3ConnectorPartitionService method update.
@Override
public void update(@Nonnull final ConnectorContext context, @Nonnull final PartitionInfo partitionInfo) {
final QualifiedName name = partitionInfo.getName();
log.debug("Start: Update partition {}", name);
final QualifiedName tableName = QualifiedName.ofTable(catalogName, name.getDatabaseName(), name.getTableName());
// Table
final Table table = getTable(tableName);
final List<Partition> partitions = partitionDao.getPartitions(table.getId(), Lists.newArrayList(name.getPartitionName()), null, null, null, null);
if (partitions.isEmpty()) {
throw new PartitionNotFoundException(tableName, name.getPartitionName());
}
partitionDao.save(infoConverter.fromPartitionInfo(partitionInfo));
log.debug("End: Update partition {}", name);
}
use of com.netflix.metacat.connector.s3.model.Table in project metacat by Netflix.
the class S3ConnectorPartitionService method exists.
@Override
public boolean exists(@Nonnull final ConnectorContext context, @Nonnull final QualifiedName name) {
boolean result = false;
final Table table = tableDao.getBySourceDatabaseTableName(catalogName, name.getDatabaseName(), name.getTableName());
if (table != null) {
result = !partitionDao.getPartitions(table.getId(), Lists.newArrayList(name.getPartitionName()), null, null, null, null).isEmpty();
}
return result;
}
use of com.netflix.metacat.connector.s3.model.Table in project metacat by Netflix.
the class S3ConnectorTableService method rename.
@Override
public void rename(@Nonnull final ConnectorContext context, @Nonnull final QualifiedName oldName, @Nonnull final QualifiedName newName) {
log.debug("Start: Rename table {} with {}", oldName, newName);
final Table oldTable = tableDao.getBySourceDatabaseTableName(catalogName, oldName.getDatabaseName(), oldName.getTableName());
if (oldTable == null) {
throw new TableNotFoundException(oldName);
}
final Table newTable = tableDao.getBySourceDatabaseTableName(catalogName, newName.getDatabaseName(), newName.getTableName());
if (newTable == null) {
oldTable.setName(newName.getTableName());
tableDao.save(oldTable);
} else {
throw new TableAlreadyExistsException(newName);
}
log.debug("End: Rename table {} with {}", oldName, newName);
}
use of com.netflix.metacat.connector.s3.model.Table in project metacat by Netflix.
the class S3ConnectorTableService method get.
@Override
public TableInfo get(@Nonnull final ConnectorContext context, @Nonnull final QualifiedName name) {
final Table table = tableDao.getBySourceDatabaseTableName(catalogName, name.getDatabaseName(), name.getTableName());
if (table == null) {
throw new TableNotFoundException(name);
}
log.debug("Get table {}", name);
return infoConverter.toTableInfo(name, table);
}
Aggregations