Skip to content

Conversation

gtrettenero
Copy link
Contributor

No description provided.

@gtrettenero gtrettenero self-assigned this May 7, 2025
@gtrettenero gtrettenero force-pushed the dbCascade branch 3 times, most recently from 10e3a71 to 8950237 Compare May 7, 2025 19:21
fix checkstyle

fix checkstyle

see if the test error is due to schema change

check tests

check tests

checkstyle

test

test

test

test

test

test

test

test hopefully last

test

checkstyle

already exists

checkstyle

test

move test

fix moved test

fix test final

Assertions.assertThrows(DataIntegrityViolationException.class, () ->
polarisConnector.deleteDatabase(dbName));
Assert.assertTrue(polarisConnector.databaseExists(dbName));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Could you also add a check to make sure the table exist as well?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

throw new InvalidMetaException(name, exception);
} catch (Exception exception) {
throw new ConnectorException(
String.format("Failed deleting polaris database %s", name), exception);
}
System.out.println("DID NOT CATCH THE DB DELETE ERROR");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should we get rid of this?

@@ -25,5 +25,5 @@ create table TBLS (
created_date TIMESTAMP not null,
last_updated_by STRING(255),
last_updated_date TIMESTAMP not null,
foreign key (db_name) references DBS(name) ON DELETE CASCADE ON UPDATE CASCADE
foreign key (db_name) references DBS(name) ON DELETE RESTRICT ON UPDATE CASCADE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want cascading updates? dbname -> dbname2 would also be bad. Less bad, but still bad.

public DatabasePreconditionFailedException(final QualifiedName name,
@Nullable final String message,
@Nullable final Throwable error) {
super(String.format("Precondition failed to update table %s. %s", name, message), error);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I think this should be update database?

/**
* Test database deletion if table exists and ON DELETE CASCADE is disabled.
*/
@Test
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to have a test at the PolarisConnectorDatabaseService level as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants