@Override
  public SnowflakeTableMetadata loadTableMetadata(SnowflakeIdentifier tableIdentifier) {
    Preconditions.checkArgument(
        tableIdentifier.type() == SnowflakeIdentifier.Type.TABLE,
        "loadTableMetadata requires a TABLE identifier, got '%s'",
        tableIdentifier);
    SnowflakeTableMetadata tableMeta;
    try {
      final String finalQuery = "SELECT SYSTEM$GET_ICEBERG_TABLE_INFORMATION(?) AS METADATA";
      tableMeta =
          connectionPool.run(
              conn ->
                  queryHarness.query(
                      conn,
                      finalQuery,
                      TABLE_METADATA_RESULT_SET_HANDLER,
                      tableIdentifier.toIdentifierString()));
    } catch (SQLException e) {
      throw snowflakeExceptionToIcebergException(
          tableIdentifier,
          e,
          String.format("Failed to get table metadata for '%s'", tableIdentifier));
    } catch (InterruptedException e) {
      throw new UncheckedInterruptedException(
          e, "Interrupted while getting table metadata for '%s'", tableIdentifier);
    }
    return tableMeta;
  }
@SuppressWarnings("unchecked")
  @Test
  public void testGetTableMetadataSQLExceptionWithoutErrorCode()
      throws SQLException, InterruptedException {
    Exception injectedException = new SQLException("Fake SQL exception");
    when(mockClientPool.run(any(ClientPool.Action.class))).thenThrow(injectedException);

    assertThatExceptionOfType(UncheckedSQLException.class)
        .isThrownBy(
            () ->
                snowflakeClient.loadTableMetadata(
                    SnowflakeIdentifier.ofTable("DB_1", "SCHEMA_1", "TABLE_1")))
        .withMessageContaining("Failed to get table metadata for 'TABLE: 'DB_1.SCHEMA_1.TABLE_1''")
        .withCause(injectedException);
  }