diff --git a/.kokoro/continuous/bigtable-it.cfg b/.kokoro/continuous/bigtable-it.cfg index 1e92e040f690..b5129e51121e 100644 --- a/.kokoro/continuous/bigtable-it.cfg +++ b/.kokoro/continuous/bigtable-it.cfg @@ -8,7 +8,7 @@ env_vars: { env_vars: { key: "INTEGRATION_TEST_ARGS" - value: "google-cloud-clients/google-cloud-bigtable -Dbigtable.env=prod -Dbigtable.table=projects/gcloud-devel/instances/google-cloud-bigtable/tables/integration-tests" + value: "google-cloud-clients/google-cloud-bigtable -Dbigtable.env=prod -Dbigtable.project=gcloud-devel -Dbigtable.instance=google-cloud-bigtable -Dbigtable.table=integration-tests" } env_vars: { diff --git a/.kokoro/nightly/bigtable-it.cfg b/.kokoro/nightly/bigtable-it.cfg index 1e92e040f690..b5129e51121e 100644 --- a/.kokoro/nightly/bigtable-it.cfg +++ b/.kokoro/nightly/bigtable-it.cfg @@ -8,7 +8,7 @@ env_vars: { env_vars: { key: "INTEGRATION_TEST_ARGS" - value: "google-cloud-clients/google-cloud-bigtable -Dbigtable.env=prod -Dbigtable.table=projects/gcloud-devel/instances/google-cloud-bigtable/tables/integration-tests" + value: "google-cloud-clients/google-cloud-bigtable -Dbigtable.env=prod -Dbigtable.project=gcloud-devel -Dbigtable.instance=google-cloud-bigtable -Dbigtable.table=integration-tests" } env_vars: { diff --git a/.kokoro/presubmit/bigtable-it.cfg b/.kokoro/presubmit/bigtable-it.cfg index 1e92e040f690..b5129e51121e 100644 --- a/.kokoro/presubmit/bigtable-it.cfg +++ b/.kokoro/presubmit/bigtable-it.cfg @@ -8,7 +8,7 @@ env_vars: { env_vars: { key: "INTEGRATION_TEST_ARGS" - value: "google-cloud-clients/google-cloud-bigtable -Dbigtable.env=prod -Dbigtable.table=projects/gcloud-devel/instances/google-cloud-bigtable/tables/integration-tests" + value: "google-cloud-clients/google-cloud-bigtable -Dbigtable.env=prod -Dbigtable.project=gcloud-devel -Dbigtable.instance=google-cloud-bigtable -Dbigtable.table=integration-tests" } env_vars: { diff --git a/TESTING.md b/TESTING.md index 44689ace5dec..a3375d13e45c 100644 --- a/TESTING.md +++ b/TESTING.md @@ -61,7 +61,9 @@ To use the `prod` environment: ```shell mvn verify -am -pl google-cloud-bigtable \ -Dbigtable.env=prod \ - -Dbigtable.table=projects/my-project/instances/my-instance/tables/my-table + -Dbigtable.project=my-project + -Dbigtable.instance=my-instance + -Dbigtable.table=my-table ``` ### Testing code that uses Bigtable Admin diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataClient.java b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataClient.java index 621c5cbf464d..aa1084b6ff1a 100644 --- a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataClient.java +++ b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataClient.java @@ -27,7 +27,6 @@ import com.google.cloud.bigtable.data.v2.models.BulkMutationBatcher; import com.google.cloud.bigtable.data.v2.models.ConditionalRowMutation; import com.google.cloud.bigtable.data.v2.models.Filters.Filter; -import com.google.cloud.bigtable.data.v2.models.InstanceName; import com.google.cloud.bigtable.data.v2.models.KeyOffset; import com.google.cloud.bigtable.data.v2.models.Query; import com.google.cloud.bigtable.data.v2.models.ReadModifyWriteRow; @@ -47,8 +46,7 @@ * get started: * *
{@code
- * InstanceName instanceName = InstanceName.of("[PROJECT]", "[INSTANCE]");
- * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create(instanceName)) {
+ * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
  *   for(Row row : bigtableDataClient.readRows(Query.create("[TABLE]")) {
  *     // Do something with row
  *   }
@@ -89,7 +87,8 @@
  * 
{@code
  * BigtableDataSettings bigtableDataSettings =
  *     BigtableDataSettings.newBuilder()
- *         .setInstanceName(InstanceName.of("[PROJECT]", "[INSTANCE]"))
+ *         .setProjectId("[PROJECT]")
+ *         .setInstanceId("[INSTANCE]")
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
  * try(BigtableDataClient bigtableDataClient = BigtableDataClient.create(bigtableDataSettings)) {
@@ -102,7 +101,8 @@
  * 
{@code
  * BigtableDataSettings bigtableDataSettings =
  *     BigtableDataSettings.newBuilder()
- *       .setInstanceName(InstanceName.of("[PROJECT]", "[INSTANCE]"))
+ *       .setProjectId("[PROJECT]")
+ *       .setInstanceId("[INSTANCE]")
  *       .setEndpoint(myEndpoint).build();
  * try(BigtableDataClient bigtableDataClient = BigtableDataClient.create(bigtableDataSettings)) {
  *   // ..
@@ -112,14 +112,31 @@
 public class BigtableDataClient implements AutoCloseable {
   private final EnhancedBigtableStub stub;
 
+  /**
+   * Constructs an instance of BigtableDataClient with default settings.
+   *
+   * @param projectId The project id of the instance to connect to.
+   * @param instanceId The id of the instance to connect to.
+   * @return A new client.
+   * @throws IOException If any.
+   */
+  public static BigtableDataClient create(String projectId, String instanceId) throws IOException {
+    BigtableDataSettings settings =
+        BigtableDataSettings.newBuilder().setProjectId(projectId).setInstanceId(instanceId).build();
+    return create(settings);
+  }
+
   /**
    * Constructs an instance of BigtableDataClient with default settings.
    *
    * @param instanceName The instance to connect to.
    * @return A new client.
    * @throws IOException If any.
+   * @deprecated Please use {@link #create(String, String)}.
    */
-  public static BigtableDataClient create(InstanceName instanceName) throws IOException {
+  @Deprecated
+  public static BigtableDataClient create(
+      com.google.cloud.bigtable.data.v2.models.InstanceName instanceName) throws IOException {
     BigtableDataSettings settings =
         BigtableDataSettings.newBuilder().setInstanceName(instanceName).build();
     return create(settings);
@@ -145,9 +162,8 @@ public static BigtableDataClient create(BigtableDataSettings settings) throws IO
    *
    * 

Sample code: * - *

{@code
-   * InstanceName instanceName = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create(instanceName)) {
+   * 
{code
+   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
    *   String tableId = "[TABLE]";
    *
    *   Row row = bigtableDataClient.readRow(tableId, ByteString.copyFromUtf8("key"));
@@ -176,9 +192,8 @@ public Row readRow(String tableId, ByteString rowKey) {
    *
    * 

Sample code: * - *

{@code
-   * InstanceName instanceName = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create(instanceName)) {
+   * 
{code
+   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
    *   String tableId = "[TABLE]";
    *
    *   Row row = bigtableDataClient.readRow(tableId, "key");
@@ -209,8 +224,7 @@ public Row readRow(String tableId, String rowKey) {
    * 

Sample code: * *

{@code
-   * InstanceName instanceName = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create(instanceName)) {
+   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
    *   String tableId = "[TABLE]";
    *
    *  // Build the filter expression
@@ -282,8 +296,7 @@ public Row readRow(String tableId, ByteString rowKey, @Nullable Filter filter) {
    * 

Sample code: * *

{@code
-   * InstanceName instanceName = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create(instanceName)) {
+   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
    *   String tableId = "[TABLE]";
    *
    *   ApiFuture futureResult = bigtableDataClient.readRowAsync(tableId,  "key");
@@ -316,8 +329,7 @@ public ApiFuture readRowAsync(String tableId, String rowKey) {
    * 

Sample code: * *

{@code
-   * InstanceName instanceName = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create(instanceName)) {
+   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
    *   String tableId = "[TABLE]";
    *
    *   ApiFuture futureResult = bigtableDataClient.readRowAsync(tableId,  ByteString.copyFromUtf8("key"));
@@ -350,8 +362,7 @@ public ApiFuture readRowAsync(String tableId, ByteString rowKey) {
    * 

Sample code: * *

{@code
-   * InstanceName instanceName = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create(instanceName)) {
+   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
    *   String tableId = "[TABLE]";
    *
    *  // Build the filter expression
@@ -515,8 +526,7 @@ public  UnaryCallable readRowCallable(RowAdapter rowAda
    * // Import the filter DSL
    * import static com.google.cloud.bigtable.data.v2.models.Filters.FILTERS;
    *
-   * InstanceName instanceName = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create(instanceName)) {
+   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
    *   String tableId = "[TABLE]";
    *
    *   Query query = Query.create(tableId)
@@ -550,8 +560,7 @@ public ServerStream readRows(Query query) {
    * 

Sample code: * *

{@code
-   * InstanceName instanceName = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create(instanceName)) {
+   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
    *   String tableId = "[TABLE]";
    *
    *   Query query = Query.create(tableId)
@@ -588,8 +597,7 @@ public void readRowsAsync(Query query, ResponseObserver observer) {
    * 

Sample code: * *

{@code
-   * InstanceName instanceName = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create(instanceName)) {
+   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
    *   String tableId = "[TABLE]";
    *
    *   Query query = Query.create(tableId)
@@ -651,8 +659,7 @@ public ServerStreamingCallable readRowsCallable() {
    * 

Sample code: * *

{@code
-   * InstanceName instanceName = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create(instanceName)) {
+   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
    *   String tableId = "[TABLE]";
    *
    *   Query query = Query.create(tableId)
@@ -688,8 +695,7 @@ public  ServerStreamingCallable readRowsCallable(RowAdapterSample code:
    *
    * 
{@code
-   * InstanceName instanceName = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create(instanceName)) {
+   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
    *   String tableId = "[TABLE_ID]";
    *
    *   List keyOffsets = bigtableDataClient.sampleRowKeys(tableId);
@@ -715,8 +721,7 @@ public List sampleRowKeys(String tableId) {
    * 

Sample code: * *

{@code
-   * InstanceName instanceName = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   * try (BigtableClient bigtableDataClient = BigtableClient.create(instanceName)) {
+   * try (BigtableClient bigtableDataClient = BigtableClient.create("[PROJECT]", "[INSTANCE]")) {
    *   ApiFuture> keyOffsetsFuture = bigtableClient.sampleRowKeysAsync("[TABLE]");
    *
    *   ApiFutures.addCallback(keyOffsetsFuture, new ApiFutureCallback>() {
@@ -747,8 +752,7 @@ public ApiFuture> sampleRowKeysAsync(String tableId) {
    * 

Sample code: * *

{@code
-   * InstanceName instanceName = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create(instanceName)) {
+   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
    *   // Synchronous invocation
    *   try {
    *     List keyOffsets = bigtableDataClient.sampleRowKeysCallable().call("[TABLE]");
@@ -787,8 +791,7 @@ public UnaryCallable> sampleRowKeysCallable() {
    * 

Sample code: * *

{@code
-   * InstanceName instanceName = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create(instanceName)) {
+   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
    *   RowMutation mutation = RowMutation.create("[TABLE]", "[ROW KEY]")
    *     .setCell("[FAMILY NAME]", "[QUALIFIER]", "[VALUE]");
    *
@@ -811,8 +814,7 @@ public void mutateRow(RowMutation rowMutation) {
    * 

Sample code: * *

{@code
-   * InstanceName instanceName = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create(instanceName)) {
+   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
    *   RowMutation mutation = RowMutation.create("[TABLE]", "[ROW KEY]")
    *     .setCell("[FAMILY NAME]", "[QUALIFIER]", "[VALUE]");
    *
@@ -844,8 +846,7 @@ public ApiFuture mutateRowAsync(RowMutation rowMutation) {
    * 

Sample code: * *

{@code
-   * InstanceName instanceName = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create(instanceName)) {
+   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
    *   RowMutation mutation = RowMutation.create("[TABLE]", "[ROW KEY]")
    *     .setCell("[FAMILY NAME]", "[QUALIFIER]", "[VALUE]");
    *
@@ -871,8 +872,7 @@ public UnaryCallable mutateRowCallable() {
    * 

Sample code: * *

{@code
-   * InstanceName instanceName = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create(instanceName)) {
+   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
    *   try (BulkMutationBatcher batcher = bigtableDataClient.newBulkMutationBatcher()) {
    *     for (String someValue : someCollection) {
    *       RowMutation mutation = RowMutation.create("[TABLE]", "[ROW KEY]")
@@ -900,8 +900,7 @@ public BulkMutationBatcher newBulkMutationBatcher() {
    * 

Sample code: * *

{@code
-   * InstanceName instanceName = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create(instanceName)) {
+   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
    *   BulkMutation batch = BulkMutation.create("[TABLE]");
    *   for (String someValue : someCollection) {
    *     batch.add("[ROW KEY]", Mutation.create().setCell("[FAMILY NAME]", "[QUALIFIER]", "[VALUE]"));
@@ -930,8 +929,7 @@ public void bulkMutateRows(BulkMutation mutation) {
    * 

Sample code: * *

{@code
-   * InstanceName instanceName = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   * try (BigtableClient bigtableClient = BigtableClient.create(instanceName)) {
+   * try (BigtableClient bigtableClient = BigtableClient.create("[PROJECT]", "[INSTANCE]")) {
    *   BulkMutation batch = BulkMutation.create("[TABLE]");
    *   for (String someValue : someCollection) {
    *     ApiFuture entryFuture = batch.add("[ROW KEY]",
@@ -966,8 +964,7 @@ public ApiFuture bulkMutateRowsAsync(BulkMutation mutation) {
    * 

Sample code: * *

{@code
-   * InstanceName instanceName = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create(instanceName)) {
+   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
    *   BulkMutation batch = BulkMutation.create("[TABLE]");
    *   for (String someValue : someCollection) {
    *     ApiFuture entryFuture = batch.add("[ROW KEY]",
@@ -987,8 +984,7 @@ public UnaryCallable bulkMutationCallable() {
    * 

Sample code: * *

{@code
-   * InstanceName instanceName = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create(instanceName)) {
+   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
    *   ConditionalRowMutation mutation = ConditionalRowMutation.create("[TABLE]", "[KEY]")
    *     .condition(FILTERS.value().regex("old-value"))
    *     .then(
@@ -1014,8 +1010,7 @@ public Boolean checkAndMutateRow(ConditionalRowMutation mutation) {
    * 

Sample code: * *

{@code
-   * InstanceName instanceName = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create(instanceName)) {
+   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
    *   ConditionalRowMutation mutation = ConditionalRowMutation.create("[TABLE]", "[KEY]")
    *     .condition(FILTERS.value().regex("old-value"))
    *     .then(
@@ -1050,8 +1045,7 @@ public ApiFuture checkAndMutateRowAsync(ConditionalRowMutation mutation
    * 

Sample code: * *

{@code
-   * InstanceName instanceName = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create(instanceName)) {
+   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
    *   ConditionalRowMutation mutation = ConditionalRowMutation.create("[TABLE]", "[KEY]")
    *     .condition(FILTERS.value().regex("old-value"))
    *     .then(
@@ -1086,8 +1080,7 @@ public UnaryCallable checkAndMutateRowCallable(
    * 

Sample code: * *

{@code
-   * InstanceName instanceName = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create(instanceName)) {
+   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
    *   ReadModifyWriteRow mutation = ReadModifyWriteRow.create("[TABLE]", "[KEY]")
    *     .increment("[FAMILY]", "[QUALIFIER]", 1)
    *     .append("[FAMILY2]", "[QUALIFIER2]", "suffix");
@@ -1113,8 +1106,7 @@ public Row readModifyWriteRow(ReadModifyWriteRow mutation) {
    * 

Sample code: * *

{@code
-   * InstanceName instanceName = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create(instanceName)) {
+   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
    *   ReadModifyWriteRow mutation = ReadModifyWriteRow.create("[TABLE]", "[KEY]")
    *     .increment("[FAMILY]", "[QUALIFIER]", 1)
    *     .append("[FAMILY2]", "[QUALIFIER2]", "suffix");
@@ -1149,8 +1141,7 @@ public ApiFuture readModifyWriteRowAsync(ReadModifyWriteRow mutation) {
    * 

Sample code: * *

{@code
-   * InstanceName instanceName = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create(instanceName)) {
+   * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
    *   ReadModifyWriteRow mutation = ReadModifyWriteRow.create("[TABLE]", "[KEY]")
    *     .increment("[FAMILY]", "[QUALIFIER]", 1)
    *     .append("[FAMILY2]", "[QUALIFIER2]", "suffix");
diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataSettings.java b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataSettings.java
index 037737488df9..58991620a52b 100644
--- a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataSettings.java
+++ b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataSettings.java
@@ -20,7 +20,6 @@
 import com.google.api.gax.rpc.ServerStreamingCallSettings;
 import com.google.api.gax.rpc.UnaryCallSettings;
 import com.google.cloud.bigtable.data.v2.models.ConditionalRowMutation;
-import com.google.cloud.bigtable.data.v2.models.InstanceName;
 import com.google.cloud.bigtable.data.v2.models.KeyOffset;
 import com.google.cloud.bigtable.data.v2.models.Query;
 import com.google.cloud.bigtable.data.v2.models.ReadModifyWriteRow;
@@ -49,7 +48,8 @@
  *
  * 
{@code
  * BigtableDataSettings.Builder settingsBuilder = BigtableDataSettings.newBuilder()
- *   .setInstanceName(InstanceName.of("my-project", "my-instance-id"))
+ *   .setProjectId("my-project")
+ *   .setInstanceId("my-instance-id")
  *   .setAppProfileId("default");
  *
  * settingsBuilder.readRowsSettings().setRetryableCodes(Code.DEADLINE_EXCEEDED, Code.UNAVAILABLE);
@@ -67,12 +67,27 @@ public static Builder newBuilder() {
     return new Builder();
   }
 
-  /** Returns the target instance */
-  public InstanceName getInstanceName() {
+  /**
+   * Returns the target instance.
+   *
+   * @deprecated Please use {@link #getProjectId()} and {@link #getInstanceId()}.
+   */
+  @Deprecated()
+  public com.google.cloud.bigtable.data.v2.models.InstanceName getInstanceName() {
     return getTypedStubSettings().getInstanceName();
   }
 
-  /** Returns the configured AppProfile to use */
+  /** Returns the target project id. */
+  public String getProjectId() {
+    return getTypedStubSettings().getProjectId();
+  }
+
+  /** Returns the target instance id. */
+  public String getInstanceId() {
+    return getTypedStubSettings().getInstanceId();
+  }
+
+  /** Returns the configured AppProfile id to use. */
   public String getAppProfileId() {
     return getTypedStubSettings().getAppProfileId();
   }
@@ -142,17 +157,55 @@ private Builder(BigtableDataSettings settings) {
     /**
      * Sets the target instance. This setting is required. All RPCs will be made in the context of
      * this setting.
+     *
+     * @deprecated Please use {@link #setProjectId(String)} and {@link #setInstanceId(String)}.
      */
-    public Builder setInstanceName(@Nonnull InstanceName instanceName) {
+    @Deprecated
+    public Builder setInstanceName(
+        @Nonnull com.google.cloud.bigtable.data.v2.models.InstanceName instanceName) {
       getTypedStubSettings().setInstanceName(instanceName);
       return this;
     }
 
-    /** Gets the {@link InstanceName} that was previously set on this Builder. */
-    public InstanceName getInstanceName() {
+    /**
+     * Gets the {@link com.google.cloud.bigtable.data.v2.models.InstanceName} that was previously
+     * set on this Builder.
+     *
+     * @deprecated Please use {@link #getProjectId()} and {@link #getInstanceId()}.
+     */
+    @Deprecated
+    public com.google.cloud.bigtable.data.v2.models.InstanceName getInstanceName() {
       return getTypedStubSettings().getInstanceName();
     }
 
+    /**
+     * Sets the target project. This setting is required. All RPCs will be made in the context of
+     * this setting.
+     */
+    public Builder setProjectId(@Nonnull String projectId) {
+      getTypedStubSettings().setProjectId(projectId);
+      return this;
+    }
+
+    /** Gets the project id that was previously set on this Builder. */
+    public String getProjectId() {
+      return getTypedStubSettings().getProjectId();
+    }
+
+    /**
+     * Sets the target instance. This setting is required. All RPCs will be made in the context of
+     * this setting.
+     */
+    public Builder setInstanceId(@Nonnull String instanceId) {
+      getTypedStubSettings().setInstanceId(instanceId);
+      return this;
+    }
+
+    /** Gets the instance id that was previously set on this Builder. */
+    public String getInstanceId() {
+      return getTypedStubSettings().getInstanceId();
+    }
+
     /**
      * Sets the AppProfile to use. An application profile (sometimes also shortened to "app
      * profile") is a group of configuration parameters for an individual use case. A client will
diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/NameUtil.java b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/NameUtil.java
new file mode 100644
index 000000000000..c1118ed181c7
--- /dev/null
+++ b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/NameUtil.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2018 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.google.cloud.bigtable.data.v2.internal;
+
+import com.google.api.core.InternalApi;
+import javax.annotation.Nonnull;
+
+/**
+ * Internal helper to compose full resource names.
+ *
+ * 

This class is considered an internal implementation detail and not meant to be used by + * applications. + */ +@InternalApi +public class NameUtil { + public static String formatInstanceName(@Nonnull String projectId, @Nonnull String instanceId) { + return "projects/" + projectId + "/instances/" + instanceId; + } + + public static String formatTableName( + @Nonnull String projectId, @Nonnull String instanceId, @Nonnull String tableId) { + return formatInstanceName(projectId, instanceId) + "/tables/" + tableId; + } +} diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/RequestContext.java b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/RequestContext.java index eabef9c766f8..dd90f5b35086 100644 --- a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/RequestContext.java +++ b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/RequestContext.java @@ -17,7 +17,6 @@ import com.google.api.core.InternalApi; import com.google.auto.value.AutoValue; -import com.google.cloud.bigtable.data.v2.models.InstanceName; /** * Contains information necessary to construct Bigtable protobuf requests from user facing models. @@ -32,12 +31,36 @@ @InternalApi @AutoValue public abstract class RequestContext { - public static RequestContext create(InstanceName instanceName, String appProfileId) { - return new AutoValue_RequestContext(instanceName, appProfileId); + + /** Creates a new instance of the {@link RequestContext}. */ + public static RequestContext create(String projectId, String instanceId, String appProfileId) { + return new AutoValue_RequestContext(projectId, instanceId, appProfileId); + } + + /** @deprecated Please use {@link #create(String, String, String)}. */ + @Deprecated + public static RequestContext create( + com.google.cloud.bigtable.data.v2.models.InstanceName instanceName, String appProfileId) { + return new AutoValue_RequestContext( + instanceName.getProject(), instanceName.getInstance(), appProfileId); } - /** The instance that the client is configured to target */ - public abstract InstanceName getInstanceName(); + /** The project id that the client is configured to target. */ + public abstract String getProjectId(); + + /** The instance id that the client is configured to target. */ + public abstract String getInstanceId(); + + /** + * The instance that the client is configured to target. + * + * @deprecated Please use {@link #getProjectId()} and {@link #getInstanceId()}. + */ + @Deprecated + public com.google.cloud.bigtable.data.v2.models.InstanceName getInstanceName() { + return com.google.cloud.bigtable.data.v2.models.InstanceName.of( + getProjectId(), getInstanceId()); + } /** The App Profile to use when processing the current request */ public abstract String getAppProfileId(); diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/BulkMutation.java b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/BulkMutation.java index 8ec8b3050388..e8951a74475c 100644 --- a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/BulkMutation.java +++ b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/BulkMutation.java @@ -17,7 +17,7 @@ import com.google.api.core.InternalApi; import com.google.bigtable.v2.MutateRowsRequest; -import com.google.bigtable.v2.TableName; +import com.google.cloud.bigtable.data.v2.internal.NameUtil; import com.google.cloud.bigtable.data.v2.internal.RequestContext; import com.google.common.base.Preconditions; import com.google.protobuf.ByteString; @@ -91,14 +91,12 @@ public BulkMutation add(@Nonnull ByteString rowKey, @Nonnull Mutation mutation) @InternalApi public MutateRowsRequest toProto(RequestContext requestContext) { - TableName tableName = - TableName.of( - requestContext.getInstanceName().getProject(), - requestContext.getInstanceName().getInstance(), - tableId); + String tableName = + NameUtil.formatTableName( + requestContext.getProjectId(), requestContext.getInstanceId(), tableId); return builder - .setTableName(tableName.toString()) + .setTableName(tableName) .setAppProfileId(requestContext.getAppProfileId()) .build(); } diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/ConditionalRowMutation.java b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/ConditionalRowMutation.java index d44e148105cc..15cc2be1f411 100644 --- a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/ConditionalRowMutation.java +++ b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/ConditionalRowMutation.java @@ -17,7 +17,7 @@ import com.google.api.core.InternalApi; import com.google.bigtable.v2.CheckAndMutateRowRequest; -import com.google.bigtable.v2.TableName; +import com.google.cloud.bigtable.data.v2.internal.NameUtil; import com.google.cloud.bigtable.data.v2.internal.RequestContext; import com.google.cloud.bigtable.data.v2.models.Filters.Filter; import com.google.common.base.Preconditions; @@ -128,11 +128,9 @@ public CheckAndMutateRowRequest toProto(RequestContext requestContext) { Preconditions.checkState( !builder.getTrueMutationsList().isEmpty() || !builder.getFalseMutationsList().isEmpty(), "ConditionalRowMutations must have `then` or `otherwise` mutations."); - TableName tableName = - TableName.of( - requestContext.getInstanceName().getProject(), - requestContext.getInstanceName().getInstance(), - tableId); + String tableName = + NameUtil.formatTableName( + requestContext.getProjectId(), requestContext.getInstanceId(), tableId); return builder .setTableName(tableName.toString()) .setAppProfileId(requestContext.getAppProfileId()) diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/InstanceName.java b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/InstanceName.java index ed64f7375dd6..fc63cdaf68e9 100644 --- a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/InstanceName.java +++ b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/InstanceName.java @@ -24,8 +24,9 @@ import java.util.Map; // Copied from com.google.bigtable.admin.v2 -// TODO: figure out how to unify admin & data resource names -/** Typesafe representation of a fully qualified Bigtable instance name */ + +/** @deprecated Please use project id and instance id strings instead. */ +@Deprecated public class InstanceName implements ResourceName { private static final PathTemplate PATH_TEMPLATE = PathTemplate.createWithoutUrlEncoding("projects/{project}/instances/{instance}"); diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/Query.java b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/Query.java index 0041fee227fb..c01174bbe07d 100644 --- a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/Query.java +++ b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/Query.java @@ -19,8 +19,8 @@ import com.google.bigtable.v2.ReadRowsRequest; import com.google.bigtable.v2.RowRange; import com.google.bigtable.v2.RowSet; -import com.google.bigtable.v2.TableName; import com.google.cloud.bigtable.data.v2.internal.ByteStringComparator; +import com.google.cloud.bigtable.data.v2.internal.NameUtil; import com.google.cloud.bigtable.data.v2.internal.RequestContext; import com.google.cloud.bigtable.data.v2.internal.RowSetUtil; import com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange; @@ -248,14 +248,12 @@ public ByteStringRange getBound() { */ @InternalApi public ReadRowsRequest toProto(RequestContext requestContext) { - TableName tableName = - TableName.of( - requestContext.getInstanceName().getProject(), - requestContext.getInstanceName().getInstance(), - tableId); + String tableName = + NameUtil.formatTableName( + requestContext.getProjectId(), requestContext.getInstanceId(), tableId); return builder - .setTableName(tableName.toString()) + .setTableName(tableName) .setAppProfileId(requestContext.getAppProfileId()) .build(); } diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/ReadModifyWriteRow.java b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/ReadModifyWriteRow.java index 9e04b14ad255..26253b9cbcc9 100644 --- a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/ReadModifyWriteRow.java +++ b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/ReadModifyWriteRow.java @@ -18,7 +18,7 @@ import com.google.api.core.InternalApi; import com.google.bigtable.v2.ReadModifyWriteRowRequest; import com.google.bigtable.v2.ReadModifyWriteRule; -import com.google.bigtable.v2.TableName; +import com.google.cloud.bigtable.data.v2.internal.NameUtil; import com.google.cloud.bigtable.data.v2.internal.RequestContext; import com.google.common.base.Preconditions; import com.google.protobuf.ByteString; @@ -128,13 +128,12 @@ public ReadModifyWriteRow increment( @InternalApi public ReadModifyWriteRowRequest toProto(RequestContext requestContext) { - TableName tableName = - TableName.of( - requestContext.getInstanceName().getProject(), - requestContext.getInstanceName().getInstance(), - tableId); + String tableName = + NameUtil.formatTableName( + requestContext.getProjectId(), requestContext.getInstanceId(), tableId); + return builder - .setTableName(tableName.toString()) + .setTableName(tableName) .setAppProfileId(requestContext.getAppProfileId()) .build(); } diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/RowMutation.java b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/RowMutation.java index 87b5cee693cd..8e6885ea6918 100644 --- a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/RowMutation.java +++ b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/RowMutation.java @@ -19,7 +19,7 @@ import com.google.bigtable.v2.MutateRowRequest; import com.google.bigtable.v2.MutateRowsRequest; import com.google.bigtable.v2.MutateRowsRequest.Entry; -import com.google.bigtable.v2.TableName; +import com.google.cloud.bigtable.data.v2.internal.NameUtil; import com.google.cloud.bigtable.data.v2.internal.RequestContext; import com.google.cloud.bigtable.data.v2.models.Range.TimestampRange; import com.google.protobuf.ByteString; @@ -158,15 +158,13 @@ public RowMutation deleteRow() { @InternalApi public MutateRowRequest toProto(RequestContext requestContext) { - TableName tableName = - TableName.of( - requestContext.getInstanceName().getProject(), - requestContext.getInstanceName().getInstance(), - tableId); + String tableName = + NameUtil.formatTableName( + requestContext.getProjectId(), requestContext.getInstanceId(), tableId); return MutateRowRequest.newBuilder() .setAppProfileId(requestContext.getAppProfileId()) - .setTableName(tableName.toString()) + .setTableName(tableName) .setRowKey(key) .addAllMutations(mutation.getMutations()) .build(); @@ -178,15 +176,13 @@ public MutateRowRequest toProto(RequestContext requestContext) { */ @InternalApi public MutateRowsRequest toBulkProto(RequestContext requestContext) { - TableName tableName = - TableName.of( - requestContext.getInstanceName().getProject(), - requestContext.getInstanceName().getInstance(), - tableId); + String tableName = + NameUtil.formatTableName( + requestContext.getProjectId(), requestContext.getInstanceId(), tableId); return MutateRowsRequest.newBuilder() .setAppProfileId(requestContext.getAppProfileId()) - .setTableName(tableName.toString()) + .setTableName(tableName) .addEntries( Entry.newBuilder().setRowKey(key).addAllMutations(mutation.getMutations()).build()) .build(); diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStub.java b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStub.java index 8100d67c9234..b9159a26eabe 100644 --- a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStub.java +++ b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStub.java @@ -149,7 +149,8 @@ public static EnhancedBigtableStub create(EnhancedBigtableStubSettings settings) this.clientContext = clientContext; this.stub = stub; this.requestContext = - RequestContext.create(settings.getInstanceName(), settings.getAppProfileId()); + RequestContext.create( + settings.getProjectId(), settings.getInstanceId(), settings.getAppProfileId()); readRowsCallable = createReadRowsCallable(new DefaultRowAdapter()); readRowCallable = createReadRowCallable(new DefaultRowAdapter()); diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettings.java b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettings.java index 298c190d4df5..ca44142a91eb 100644 --- a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettings.java +++ b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettings.java @@ -29,7 +29,6 @@ import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.bigtable.data.v2.internal.DummyBatchingDescriptor; import com.google.cloud.bigtable.data.v2.models.ConditionalRowMutation; -import com.google.cloud.bigtable.data.v2.models.InstanceName; import com.google.cloud.bigtable.data.v2.models.KeyOffset; import com.google.cloud.bigtable.data.v2.models.Query; import com.google.cloud.bigtable.data.v2.models.ReadModifyWriteRow; @@ -61,7 +60,8 @@ * *

{@code
  * BigtableDataSettings.Builder settingsBuilder = BigtableDataSettings.newBuilder()
- *   .setInstanceName(InstanceName.of("my-project", "my-instance-id"))
+ *   .setProjectId("my-project-id")
+ *   .setInstanceId("my-instance-id")
  *   .setAppProfileId("default");
  *
  * settingsBuilder.readRowsSettings()
@@ -108,7 +108,8 @@ public class EnhancedBigtableStubSettings extends StubSettings readRowsSettings;
@@ -131,7 +132,8 @@ private EnhancedBigtableStubSettings(Builder builder) {
             .equals(builder.readRowsSettings.getRetryableCodes()),
         "Single ReadRow retry codes must match ReadRows retry codes");
 
-    instanceName = builder.instanceName;
+    projectId = builder.projectId;
+    instanceId = builder.instanceId;
     appProfileId = builder.appProfileId;
 
     // Per method settings.
@@ -149,9 +151,24 @@ public static Builder newBuilder() {
     return new Builder();
   }
 
-  /** Returns the target instance */
-  public InstanceName getInstanceName() {
-    return instanceName;
+  /**
+   * Returns the target instance.
+   *
+   * @deprecated Please use {@link #getProjectId()} and {@link #getInstanceId()}
+   */
+  @Deprecated
+  public com.google.cloud.bigtable.data.v2.models.InstanceName getInstanceName() {
+    return com.google.cloud.bigtable.data.v2.models.InstanceName.of(projectId, instanceId);
+  }
+
+  /** Returns the project id of the target instance. */
+  public String getProjectId() {
+    return projectId;
+  }
+
+  /** Returns the target instance id. */
+  public String getInstanceId() {
+    return instanceId;
   }
 
   /** Returns the configured AppProfile to use */
@@ -213,7 +230,9 @@ public Builder toBuilder() {
 
   /** Builder for BigtableDataSettings. */
   public static class Builder extends StubSettings.Builder {
-    private InstanceName instanceName;
+
+    private String projectId;
+    private String instanceId;
     private String appProfileId;
 
     private final ServerStreamingCallSettings.Builder readRowsSettings;
@@ -304,7 +323,8 @@ private Builder() {
 
     private Builder(EnhancedBigtableStubSettings settings) {
       super(settings);
-      instanceName = settings.instanceName;
+      projectId = settings.projectId;
+      instanceId = settings.instanceId;
       appProfileId = settings.appProfileId;
 
       // Per method settings.
@@ -333,16 +353,60 @@ private static void copyRetrySettings(
     /**
      * Sets the target instance. This setting is required. All RPCs will be made in the context of
      * this setting.
+     *
+     * @deprecated Please use {@link #setProjectId(String)} and {@link #setInstanceId(String)}.
      */
-    public Builder setInstanceName(@Nonnull InstanceName instanceName) {
+    @Deprecated
+    public Builder setInstanceName(
+        @Nonnull com.google.cloud.bigtable.data.v2.models.InstanceName instanceName) {
       Preconditions.checkNotNull(instanceName);
-      this.instanceName = instanceName;
+      this.projectId = instanceName.getProject();
+      this.instanceId = instanceName.getInstance();
+      return this;
+    }
+
+    /**
+     * Gets the {@link com.google.cloud.bigtable.data.v2.models.InstanceName} that was previously
+     * set on this Builder.
+     *
+     * @deprecated Please use {@link #getProjectId()} and {@link #getInstanceId()}.
+     */
+    @Deprecated
+    public com.google.cloud.bigtable.data.v2.models.InstanceName getInstanceName() {
+      if (projectId != null && instanceId != null) {
+        return com.google.cloud.bigtable.data.v2.models.InstanceName.of(projectId, instanceId);
+      }
+      return null;
+    }
+
+    /**
+     * Sets the project id of that target instance. This setting is required. All RPCs will be made
+     * in the context of this setting.
+     */
+    public Builder setProjectId(@Nonnull String projectId) {
+      Preconditions.checkNotNull(projectId);
+      this.projectId = projectId;
+      return this;
+    }
+
+    /** Gets the project id of the target instance that was previously set on this Builder. */
+    public String getProjectId() {
+      return projectId;
+    }
+
+    /**
+     * Sets the target instance id. This setting is required. All RPCs will be made in the context
+     * of this setting.
+     */
+    public Builder setInstanceId(@Nonnull String instanceId) {
+      Preconditions.checkNotNull(instanceId);
+      this.instanceId = instanceId;
       return this;
     }
 
-    /** Gets the {@link InstanceName} that was previously set on this Builder. */
-    public InstanceName getInstanceName() {
-      return instanceName;
+    /** Gets the target instance id that was previously set on this Builder. */
+    public String getInstanceId() {
+      return instanceId;
     }
 
     /**
@@ -399,7 +463,8 @@ public UnaryCallSettings.Builder readModifyWriteRowSett
 
     @SuppressWarnings("unchecked")
     public EnhancedBigtableStubSettings build() {
-      Preconditions.checkState(instanceName != null, "InstanceName must be set");
+      Preconditions.checkState(projectId != null, "Project id must be set");
+      Preconditions.checkState(instanceId != null, "Instance id must be set");
 
       return new EnhancedBigtableStubSettings(this);
     }
diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/SampleRowKeysCallable.java b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/SampleRowKeysCallable.java
index 554bf2bb08a8..7658e414922b 100644
--- a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/SampleRowKeysCallable.java
+++ b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/SampleRowKeysCallable.java
@@ -22,7 +22,7 @@
 import com.google.api.gax.rpc.UnaryCallable;
 import com.google.bigtable.v2.SampleRowKeysRequest;
 import com.google.bigtable.v2.SampleRowKeysResponse;
-import com.google.bigtable.v2.TableName;
+import com.google.cloud.bigtable.data.v2.internal.NameUtil;
 import com.google.cloud.bigtable.data.v2.internal.RequestContext;
 import com.google.cloud.bigtable.data.v2.models.KeyOffset;
 import com.google.common.collect.ImmutableList;
@@ -44,15 +44,13 @@ class SampleRowKeysCallable extends UnaryCallable> {
 
   @Override
   public ApiFuture> futureCall(String tableId, ApiCallContext context) {
-    TableName tableName =
-        TableName.of(
-            requestContext.getInstanceName().getProject(),
-            requestContext.getInstanceName().getInstance(),
-            tableId);
+    String tableName =
+        NameUtil.formatTableName(
+            requestContext.getProjectId(), requestContext.getInstanceId(), tableId);
 
     SampleRowKeysRequest request =
         SampleRowKeysRequest.newBuilder()
-            .setTableName(tableName.toString())
+            .setTableName(tableName)
             .setAppProfileId(requestContext.getAppProfileId())
             .build();
 
diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/BaseBigtableDataClientTest.java b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/BaseBigtableDataClientTest.java
index 8fa5813be340..0b55cb6ed4b0 100644
--- a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/BaseBigtableDataClientTest.java
+++ b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/BaseBigtableDataClientTest.java
@@ -40,7 +40,7 @@
 import com.google.bigtable.v2.RowFilter;
 import com.google.bigtable.v2.SampleRowKeysRequest;
 import com.google.bigtable.v2.SampleRowKeysResponse;
-import com.google.bigtable.v2.TableName;
+import com.google.cloud.bigtable.data.v2.internal.NameUtil;
 import com.google.protobuf.ByteString;
 import com.google.protobuf.GeneratedMessageV3;
 import io.grpc.Status;
@@ -101,9 +101,8 @@ public void readRowsTest() throws Exception {
     ReadRowsResponse expectedResponse =
         ReadRowsResponse.newBuilder().setLastScannedRowKey(lastScannedRowKey).build();
     mockBigtable.addResponse(expectedResponse);
-    TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
-    ReadRowsRequest request =
-        ReadRowsRequest.newBuilder().setTableName(tableName.toString()).build();
+    String tableName = NameUtil.formatTableName("[PROJECT]", "[INSTANCE]", "[TABLE]");
+    ReadRowsRequest request = ReadRowsRequest.newBuilder().setTableName(tableName).build();
 
     MockStreamObserver responseObserver = new MockStreamObserver<>();
 
@@ -120,9 +119,8 @@ public void readRowsTest() throws Exception {
   public void readRowsExceptionTest() throws Exception {
     StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
     mockBigtable.addException(exception);
-    TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
-    ReadRowsRequest request =
-        ReadRowsRequest.newBuilder().setTableName(tableName.toString()).build();
+    String tableName = NameUtil.formatTableName("[PROJECT]", "[INSTANCE]", "[TABLE]");
+    ReadRowsRequest request = ReadRowsRequest.newBuilder().setTableName(tableName).build();
 
     MockStreamObserver responseObserver = new MockStreamObserver<>();
 
@@ -147,9 +145,9 @@ public void sampleRowKeysTest() throws Exception {
     SampleRowKeysResponse expectedResponse =
         SampleRowKeysResponse.newBuilder().setRowKey(rowKey).setOffsetBytes(offsetBytes).build();
     mockBigtable.addResponse(expectedResponse);
-    TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
+    String tableName = NameUtil.formatTableName("[PROJECT]", "[INSTANCE]", "[TABLE]");
     SampleRowKeysRequest request =
-        SampleRowKeysRequest.newBuilder().setTableName(tableName.toString()).build();
+        SampleRowKeysRequest.newBuilder().setTableName(tableName).build();
 
     MockStreamObserver responseObserver = new MockStreamObserver<>();
 
@@ -167,9 +165,9 @@ public void sampleRowKeysTest() throws Exception {
   public void sampleRowKeysExceptionTest() throws Exception {
     StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
     mockBigtable.addException(exception);
-    TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
+    String tableName = NameUtil.formatTableName("[PROJECT]", "[INSTANCE]", "[TABLE]");
     SampleRowKeysRequest request =
-        SampleRowKeysRequest.newBuilder().setTableName(tableName.toString()).build();
+        SampleRowKeysRequest.newBuilder().setTableName(tableName).build();
 
     MockStreamObserver responseObserver = new MockStreamObserver<>();
 
@@ -193,7 +191,7 @@ public void mutateRowTest() {
     MutateRowResponse expectedResponse = MutateRowResponse.newBuilder().build();
     mockBigtable.addResponse(expectedResponse);
 
-    TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
+    String tableName = NameUtil.formatTableName("[PROJECT]", "[INSTANCE]", "[TABLE]");
     ByteString rowKey = ByteString.copyFromUtf8("122");
     List mutations = new ArrayList<>();
 
@@ -204,7 +202,7 @@ public void mutateRowTest() {
     Assert.assertEquals(1, actualRequests.size());
     MutateRowRequest actualRequest = (MutateRowRequest) actualRequests.get(0);
 
-    Assert.assertEquals(tableName, TableName.parse(actualRequest.getTableName()));
+    Assert.assertEquals(tableName, actualRequest.getTableName());
     Assert.assertEquals(rowKey, actualRequest.getRowKey());
     Assert.assertEquals(mutations, actualRequest.getMutationsList());
     Assert.assertTrue(
@@ -220,7 +218,7 @@ public void mutateRowExceptionTest() throws Exception {
     mockBigtable.addException(exception);
 
     try {
-      TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
+      String tableName = NameUtil.formatTableName("[PROJECT]", "[INSTANCE]", "[TABLE]");
       ByteString rowKey = ByteString.copyFromUtf8("122");
       List mutations = new ArrayList<>();
 
@@ -236,13 +234,10 @@ public void mutateRowExceptionTest() throws Exception {
   public void mutateRowsTest() throws Exception {
     MutateRowsResponse expectedResponse = MutateRowsResponse.newBuilder().build();
     mockBigtable.addResponse(expectedResponse);
-    TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
+    String tableName = NameUtil.formatTableName("[PROJECT]", "[INSTANCE]", "[TABLE]");
     List entries = new ArrayList<>();
     MutateRowsRequest request =
-        MutateRowsRequest.newBuilder()
-            .setTableName(tableName.toString())
-            .addAllEntries(entries)
-            .build();
+        MutateRowsRequest.newBuilder().setTableName(tableName).addAllEntries(entries).build();
 
     MockStreamObserver responseObserver = new MockStreamObserver<>();
 
@@ -260,13 +255,10 @@ public void mutateRowsTest() throws Exception {
   public void mutateRowsExceptionTest() throws Exception {
     StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
     mockBigtable.addException(exception);
-    TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
+    String tableName = NameUtil.formatTableName("[PROJECT]", "[INSTANCE]", "[TABLE]");
     List entries = new ArrayList<>();
     MutateRowsRequest request =
-        MutateRowsRequest.newBuilder()
-            .setTableName(tableName.toString())
-            .addAllEntries(entries)
-            .build();
+        MutateRowsRequest.newBuilder().setTableName(tableName).addAllEntries(entries).build();
 
     MockStreamObserver responseObserver = new MockStreamObserver<>();
 
@@ -292,7 +284,7 @@ public void checkAndMutateRowTest() {
         CheckAndMutateRowResponse.newBuilder().setPredicateMatched(predicateMatched).build();
     mockBigtable.addResponse(expectedResponse);
 
-    TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
+    String tableName = NameUtil.formatTableName("[PROJECT]", "[INSTANCE]", "[TABLE]");
     ByteString rowKey = ByteString.copyFromUtf8("122");
     RowFilter predicateFilter = RowFilter.newBuilder().build();
     List trueMutations = new ArrayList<>();
@@ -306,7 +298,7 @@ public void checkAndMutateRowTest() {
     Assert.assertEquals(1, actualRequests.size());
     CheckAndMutateRowRequest actualRequest = (CheckAndMutateRowRequest) actualRequests.get(0);
 
-    Assert.assertEquals(tableName, TableName.parse(actualRequest.getTableName()));
+    Assert.assertEquals(tableName, actualRequest.getTableName());
     Assert.assertEquals(rowKey, actualRequest.getRowKey());
     Assert.assertEquals(predicateFilter, actualRequest.getPredicateFilter());
     Assert.assertEquals(trueMutations, actualRequest.getTrueMutationsList());
@@ -324,7 +316,7 @@ public void checkAndMutateRowExceptionTest() throws Exception {
     mockBigtable.addException(exception);
 
     try {
-      TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
+      String tableName = NameUtil.formatTableName("[PROJECT]", "[INSTANCE]", "[TABLE]");
       ByteString rowKey = ByteString.copyFromUtf8("122");
       RowFilter predicateFilter = RowFilter.newBuilder().build();
       List trueMutations = new ArrayList<>();
@@ -343,7 +335,7 @@ public void readModifyWriteRowTest() {
     ReadModifyWriteRowResponse expectedResponse = ReadModifyWriteRowResponse.newBuilder().build();
     mockBigtable.addResponse(expectedResponse);
 
-    TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
+    String tableName = NameUtil.formatTableName("[PROJECT]", "[INSTANCE]", "[TABLE]");
     ByteString rowKey = ByteString.copyFromUtf8("122");
     List rules = new ArrayList<>();
 
@@ -354,7 +346,7 @@ public void readModifyWriteRowTest() {
     Assert.assertEquals(1, actualRequests.size());
     ReadModifyWriteRowRequest actualRequest = (ReadModifyWriteRowRequest) actualRequests.get(0);
 
-    Assert.assertEquals(tableName, TableName.parse(actualRequest.getTableName()));
+    Assert.assertEquals(tableName, actualRequest.getTableName());
     Assert.assertEquals(rowKey, actualRequest.getRowKey());
     Assert.assertEquals(rules, actualRequest.getRulesList());
     Assert.assertTrue(
@@ -370,7 +362,7 @@ public void readModifyWriteRowExceptionTest() throws Exception {
     mockBigtable.addException(exception);
 
     try {
-      TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
+      String tableName = NameUtil.formatTableName("[PROJECT]", "[INSTANCE]", "[TABLE]");
       ByteString rowKey = ByteString.copyFromUtf8("122");
       List rules = new ArrayList<>();
 
diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/internal/RowSetUtilTest.java b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/internal/RowSetUtilTest.java
index 21d1dd7b0c74..555676ffb1d1 100644
--- a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/internal/RowSetUtilTest.java
+++ b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/internal/RowSetUtilTest.java
@@ -23,6 +23,7 @@
 import com.google.common.collect.ImmutableSortedSet;
 import com.google.common.collect.Lists;
 import com.google.protobuf.ByteString;
+import java.util.Arrays;
 import java.util.List;
 import java.util.SortedSet;
 import org.junit.Test;
@@ -571,7 +572,7 @@ public void multipleRangeBoundTest() {
   // Helpers
   private static void verifySplit(RowSet input, SortedSet splits, RowSet... expected) {
     List actualWithNull = RowSetUtil.split(input, splits, true);
-    assertThat(actualWithNull).containsExactly(expected).inOrder();
+    assertThat(actualWithNull).containsExactlyElementsIn(Arrays.asList(expected)).inOrder();
 
     List actualNonnull = RowSetUtil.split(input, splits, false);
     List expectedNonnull = Lists.newArrayList();
diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/BulkMutationBatcherIT.java b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/BulkMutationBatcherIT.java
index b0d82d8d9388..97d42978ed9d 100644
--- a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/BulkMutationBatcherIT.java
+++ b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/BulkMutationBatcherIT.java
@@ -39,7 +39,7 @@ public class BulkMutationBatcherIT {
   @Test
   public void test() throws Exception {
     BigtableDataClient client = testEnvRule.env().getDataClient();
-    String tableId = testEnvRule.env().getTableName().getTable();
+    String tableId = testEnvRule.env().getTableId();
     String family = testEnvRule.env().getFamilyId();
     String rowPrefix = testEnvRule.env().getRowPrefix();
 
diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/CheckAndMutateIT.java b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/CheckAndMutateIT.java
index 2b65517f232d..53f1a8997dd1 100644
--- a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/CheckAndMutateIT.java
+++ b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/CheckAndMutateIT.java
@@ -37,7 +37,7 @@ public class CheckAndMutateIT {
 
   @Test
   public void test() throws Exception {
-    String tableId = testEnvRule.env().getTableName().getTable();
+    String tableId = testEnvRule.env().getTableId();
     String rowKey = testEnvRule.env().getRowPrefix();
     String familyId = testEnvRule.env().getFamilyId();
 
diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/MutateRowIT.java b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/MutateRowIT.java
index 4fdfef18e665..545028e14a58 100644
--- a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/MutateRowIT.java
+++ b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/MutateRowIT.java
@@ -41,7 +41,7 @@ public void test() throws Exception {
         .env()
         .getDataClient()
         .mutateRowAsync(
-            RowMutation.create(testEnvRule.env().getTableName().getTable(), rowKey)
+            RowMutation.create(testEnvRule.env().getTableId(), rowKey)
                 .setCell(familyId, "q", "myVal")
                 .setCell(familyId, "q2", "myVal2")
                 .setCell(familyId, "q3", "myVal3"))
@@ -51,8 +51,7 @@ public void test() throws Exception {
         .env()
         .getDataClient()
         .mutateRowAsync(
-            RowMutation.create(testEnvRule.env().getTableName().getTable(), rowKey)
-                .deleteCells(familyId, "q2"))
+            RowMutation.create(testEnvRule.env().getTableId(), rowKey).deleteCells(familyId, "q2"))
         .get(1, TimeUnit.MINUTES);
 
     Row row =
@@ -61,7 +60,7 @@ public void test() throws Exception {
             .getDataClient()
             .readRowsCallable()
             .first()
-            .call(Query.create(testEnvRule.env().getTableName().getTable()).rowKey(rowKey));
+            .call(Query.create(testEnvRule.env().getTableId()).rowKey(rowKey));
 
     assertThat(row.getCells()).hasSize(2);
     assertThat(row.getCells().get(0).getValue()).isEqualTo(ByteString.copyFromUtf8("myVal"));
diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/ReadIT.java b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/ReadIT.java
index 203c5179190d..d1f621a814ce 100644
--- a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/ReadIT.java
+++ b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/ReadIT.java
@@ -59,7 +59,7 @@ public void setUp() {
   public void readEmpty() throws Throwable {
     String uniqueKey = prefix + "-readEmpty";
 
-    Query query = Query.create(testEnvRule.env().getTableName().getTable()).rowKey(uniqueKey);
+    Query query = Query.create(testEnvRule.env().getTableId()).rowKey(uniqueKey);
 
     // Sync
     ArrayList rows = Lists.newArrayList(testEnvRule.env().getDataClient().readRows(query));
@@ -86,7 +86,7 @@ public void read() throws Throwable {
           .getDataClient()
           .mutateRowCallable()
           .call(
-              RowMutation.create(testEnvRule.env().getTableName().getTable(), uniqueKey + "-" + i)
+              RowMutation.create(testEnvRule.env().getTableId(), uniqueKey + "-" + i)
                   .setCell(testEnvRule.env().getFamilyId(), "q", timestampMicros, "my-value"));
 
       expectedRows.add(
@@ -101,7 +101,7 @@ public void read() throws Throwable {
                       ByteString.copyFromUtf8("my-value")))));
     }
 
-    String tableId = testEnvRule.env().getTableName().getTable();
+    String tableId = testEnvRule.env().getTableId();
 
     // Sync
     Query query = Query.create(tableId).range(uniqueKey + "-0", uniqueKey + "-" + numRows);
@@ -133,7 +133,7 @@ public void readSingleNonexistentAsyncCallback() throws Exception {
         testEnvRule
             .env()
             .getDataClient()
-            .readRowAsync(testEnvRule.env().getTableName().getTable(), "somenonexistentkey");
+            .readRowAsync(testEnvRule.env().getTableId(), "somenonexistentkey");
 
     final AtomicBoolean found = new AtomicBoolean();
     final CountDownLatch latch = new CountDownLatch(1);
diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/ReadModifyWriteIT.java b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/ReadModifyWriteIT.java
index 296f43e2ddbe..692027db5446 100644
--- a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/ReadModifyWriteIT.java
+++ b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/ReadModifyWriteIT.java
@@ -35,7 +35,7 @@ public class ReadModifyWriteIT {
 
   @Test
   public void test() throws InterruptedException, ExecutionException, TimeoutException {
-    String tableId = testEnvRule.env().getTableName().getTable();
+    String tableId = testEnvRule.env().getTableId();
     String family = testEnvRule.env().getFamilyId();
     String rowKey = testEnvRule.env().getRowPrefix();
 
diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/SampleRowsIT.java b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/SampleRowsIT.java
index e77fcdd98a16..20bba81ea4ae 100644
--- a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/SampleRowsIT.java
+++ b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/SampleRowsIT.java
@@ -47,15 +47,13 @@ public void test() throws InterruptedException, ExecutionException, TimeoutExcep
       ApiFuture future =
           client.mutateRowAsync(
               RowMutation.create(
-                      testEnvRule.env().getTableName().getTable(),
-                      testEnvRule.env().getRowPrefix() + "-" + i)
+                      testEnvRule.env().getTableId(), testEnvRule.env().getRowPrefix() + "-" + i)
                   .setCell(testEnvRule.env().getFamilyId(), "", "value"));
       futures.add(future);
     }
     ApiFutures.allAsList(futures).get(1, TimeUnit.MINUTES);
 
-    ApiFuture> future =
-        client.sampleRowKeysAsync(testEnvRule.env().getTableName().getTable());
+    ApiFuture> future = client.sampleRowKeysAsync(testEnvRule.env().getTableId());
 
     List results = future.get(1, TimeUnit.MINUTES);
 
diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/env/Emulator.java b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/env/Emulator.java
index 738b330007c9..d8e7b00b0c4f 100644
--- a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/env/Emulator.java
+++ b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/env/Emulator.java
@@ -23,7 +23,6 @@
 import com.google.bigtable.admin.v2.BigtableTableAdminGrpc.BigtableTableAdminBlockingStub;
 import com.google.cloud.bigtable.data.v2.BigtableDataClient;
 import com.google.cloud.bigtable.data.v2.BigtableDataSettings;
-import com.google.cloud.bigtable.data.v2.models.InstanceName;
 import com.google.common.io.CharStreams;
 import io.grpc.ManagedChannel;
 import io.grpc.ManagedChannelBuilder;
@@ -57,8 +56,8 @@ class Emulator {
   private BigtableTableAdminBlockingStub tableAdminClient;
   private BigtableDataClient dataClient;
 
-  private static final InstanceName INSTANCE_NAME =
-      InstanceName.of("fake-project", "fake-instance");
+  private static final String PROJECT_ID = "fake-project";
+  private static final String INSTANCE_ID = "fake-instance";
 
   // Use the gcloud installed emulator
   static Emulator createGCloud() {
@@ -101,7 +100,10 @@ void start() throws Exception {
 
     dataClient =
         BigtableDataClient.create(
-            configureClient(BigtableDataSettings.newBuilder().setInstanceName(INSTANCE_NAME))
+            configureClient(
+                    BigtableDataSettings.newBuilder()
+                        .setProjectId(PROJECT_ID)
+                        .setInstanceId(INSTANCE_ID))
                 .build());
 
     Runtime.getRuntime()
diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/env/EmulatorEnv.java b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/env/EmulatorEnv.java
index 3741246aabb2..c4ce28ee13e2 100644
--- a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/env/EmulatorEnv.java
+++ b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/env/EmulatorEnv.java
@@ -18,13 +18,12 @@
 import com.google.bigtable.admin.v2.ColumnFamily;
 import com.google.bigtable.admin.v2.CreateTableRequest;
 import com.google.bigtable.admin.v2.Table;
-import com.google.bigtable.v2.TableName;
 import com.google.cloud.bigtable.data.v2.BigtableDataClient;
-import com.google.cloud.bigtable.data.v2.models.InstanceName;
+import com.google.cloud.bigtable.data.v2.internal.NameUtil;
 
 public class EmulatorEnv implements TestEnv {
-  private static final InstanceName INSTANCE_NAME =
-      InstanceName.of("fake-project", "fake-instance");
+  private static final String PROJECT_ID = "fake-project";
+  private static final String INSTANCE_ID = "fake-instance";
   private static final String TABLE_ID = "default-table";
   private static final String FAMILY_ID = "cf";
 
@@ -39,7 +38,7 @@ public void start() throws Exception {
         .getTableAdminClient()
         .createTable(
             CreateTableRequest.newBuilder()
-                .setParent(INSTANCE_NAME.toString())
+                .setParent(NameUtil.formatInstanceName(PROJECT_ID, INSTANCE_ID))
                 .setTableId(TABLE_ID)
                 .setTable(
                     Table.newBuilder()
@@ -53,8 +52,18 @@ public void stop() throws Exception {
   }
 
   @Override
-  public TableName getTableName() {
-    return TableName.of(INSTANCE_NAME.getProject(), INSTANCE_NAME.getInstance(), TABLE_ID);
+  public String getProjectId() {
+    return PROJECT_ID;
+  }
+
+  @Override
+  public String getInstanceId() {
+    return INSTANCE_ID;
+  }
+
+  @Override
+  public String getTableId() {
+    return TABLE_ID;
   }
 
   @Override
diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/env/ProdEnv.java b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/env/ProdEnv.java
index f418c3c2d9f7..6f3f333350dd 100644
--- a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/env/ProdEnv.java
+++ b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/env/ProdEnv.java
@@ -18,9 +18,7 @@
 import com.google.api.core.ApiFuture;
 import com.google.api.core.ApiFutures;
 import com.google.api.gax.rpc.ServerStream;
-import com.google.bigtable.v2.TableName;
 import com.google.cloud.bigtable.data.v2.BigtableDataClient;
-import com.google.cloud.bigtable.data.v2.models.InstanceName;
 import com.google.cloud.bigtable.data.v2.models.Query;
 import com.google.cloud.bigtable.data.v2.models.Row;
 import com.google.cloud.bigtable.data.v2.models.RowMutation;
@@ -43,30 +41,35 @@
  * 
  */
 public class ProdEnv implements TestEnv {
+  private static final String PROJECT_PROPERTY_NAME = "bigtable.project";
+  private static final String INSTANCE_PROPERTY_NAME = "bigtable.instance";
   private static final String TABLE_PROPERTY_NAME = "bigtable.table";
 
-  private TableName tableName;
+  private final String projectId;
+  private final String instanceId;
+  private final String tableId;
   private static final String FAMILY_ID = "cf";
   private String rowPrefix;
 
   private BigtableDataClient dataClient;
 
   static ProdEnv fromSystemProperties() {
-    String tableNameStr = getRequiredProperty(TABLE_PROPERTY_NAME);
-    TableName tableName = TableName.parse(tableNameStr);
-
-    return new ProdEnv(tableName);
+    return new ProdEnv(
+        getRequiredProperty(PROJECT_PROPERTY_NAME),
+        getRequiredProperty(INSTANCE_PROPERTY_NAME),
+        getRequiredProperty(TABLE_PROPERTY_NAME));
   }
 
-  ProdEnv(TableName tableName) {
-    this.tableName = tableName;
+  public ProdEnv(String projectId, String instanceId, String tableId) {
+    this.projectId = projectId;
+    this.instanceId = instanceId;
+    this.tableId = tableId;
+    this.rowPrefix = UUID.randomUUID() + "-";
   }
 
   @Override
   public void start() throws IOException {
-    rowPrefix = UUID.randomUUID() + "-";
-    dataClient =
-        BigtableDataClient.create(InstanceName.of(tableName.getProject(), tableName.getInstance()));
+    dataClient = BigtableDataClient.create(projectId, instanceId);
   }
 
   @Override
@@ -81,8 +84,18 @@ public BigtableDataClient getDataClient() {
   }
 
   @Override
-  public TableName getTableName() {
-    return tableName;
+  public String getProjectId() {
+    return projectId;
+  }
+
+  @Override
+  public String getInstanceId() {
+    return instanceId;
+  }
+
+  @Override
+  public String getTableId() {
+    return tableId;
   }
 
   @Override
@@ -96,14 +109,13 @@ public String getRowPrefix() {
   }
 
   private void deleteRows() throws InterruptedException, ExecutionException, TimeoutException {
-    Query query = Query.create(tableName.getTable()).prefix(rowPrefix);
+    Query query = Query.create(tableId).prefix(rowPrefix);
 
     List> futures = Lists.newArrayList();
     ServerStream rows = dataClient.readRows(query);
     for (Row row : rows) {
       ApiFuture future =
-          dataClient.mutateRowAsync(
-              RowMutation.create(tableName.getTable(), row.getKey()).deleteRow());
+          dataClient.mutateRowAsync(RowMutation.create(tableId, row.getKey()).deleteRow());
       futures.add(future);
     }
 
diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/env/TestEnv.java b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/env/TestEnv.java
index 00a81de596c2..69c70efc3189 100644
--- a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/env/TestEnv.java
+++ b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/env/TestEnv.java
@@ -15,7 +15,6 @@
  */
 package com.google.cloud.bigtable.data.v2.it.env;
 
-import com.google.bigtable.v2.TableName;
 import com.google.cloud.bigtable.data.v2.BigtableDataClient;
 
 /**
@@ -30,7 +29,11 @@ public interface TestEnv {
 
   BigtableDataClient getDataClient();
 
-  TableName getTableName();
+  String getProjectId();
+
+  String getInstanceId();
+
+  String getTableId();
 
   String getFamilyId();
 
diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/BulkMutationTest.java b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/BulkMutationTest.java
index c6734c7b577c..ab203d25f269 100644
--- a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/BulkMutationTest.java
+++ b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/BulkMutationTest.java
@@ -18,7 +18,7 @@
 import static com.google.common.truth.Truth.assertThat;
 
 import com.google.bigtable.v2.MutateRowsRequest;
-import com.google.bigtable.v2.TableName;
+import com.google.cloud.bigtable.data.v2.internal.NameUtil;
 import com.google.cloud.bigtable.data.v2.internal.RequestContext;
 import com.google.protobuf.ByteString;
 import com.google.protobuf.TextFormat;
@@ -34,12 +34,12 @@
 
 @RunWith(JUnit4.class)
 public class BulkMutationTest {
-  private static final InstanceName INSTANCE_NAME =
-      InstanceName.of("fake-project", "fake-instance");
+  private static final String PROJECT_ID = "fake-project";
+  private static final String INSTANCE_ID = "fake-instance";
   private static final String TABLE_ID = "fake-table";
   private static final String APP_PROFILE = "fake-profile";
   private static final RequestContext REQUEST_CONTEXT =
-      RequestContext.create(INSTANCE_NAME, APP_PROFILE);
+      RequestContext.create(PROJECT_ID, INSTANCE_ID, APP_PROFILE);
 
   @Test
   public void test() throws ParseException {
@@ -58,8 +58,7 @@ public void test() throws ParseException {
 
     MutateRowsRequest.Builder expected =
         MutateRowsRequest.newBuilder()
-            .setTableName(
-                TableName.format(INSTANCE_NAME.getProject(), INSTANCE_NAME.getInstance(), TABLE_ID))
+            .setTableName(NameUtil.formatTableName(PROJECT_ID, INSTANCE_ID, TABLE_ID))
             .setAppProfileId(APP_PROFILE);
     TextFormat.merge(
         "entries {"
diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/ConditionalRowMutationTest.java b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/ConditionalRowMutationTest.java
index dfdad7548bf7..044e54f4ef3d 100644
--- a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/ConditionalRowMutationTest.java
+++ b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/ConditionalRowMutationTest.java
@@ -20,7 +20,7 @@
 import com.google.bigtable.v2.CheckAndMutateRowRequest;
 import com.google.bigtable.v2.Mutation.DeleteFromColumn;
 import com.google.bigtable.v2.RowFilter;
-import com.google.bigtable.v2.TableName;
+import com.google.cloud.bigtable.data.v2.internal.NameUtil;
 import com.google.cloud.bigtable.data.v2.internal.RequestContext;
 import com.google.protobuf.ByteString;
 import java.io.ByteArrayInputStream;
@@ -34,15 +34,13 @@
 
 @RunWith(JUnit4.class)
 public class ConditionalRowMutationTest {
-  private static final InstanceName INSTANCE_NAME =
-      InstanceName.of("fake-project", "fake-instance");
-  private static final TableName TABLE_NAME =
-      TableName.of(INSTANCE_NAME.getProject(), INSTANCE_NAME.getInstance(), "fake-table");
-  private static final String TABLE_ID = TABLE_NAME.getTable();
+  private static final String PROJECT_ID = "fake-project";
+  private static final String INSTANCE_ID = "fake-instance";
+  private static final String TABLE_ID = "fake-table";
 
   private static final String APP_PROFILE_ID = "fake-profile";
   private static final RequestContext REQUEST_CONTEXT =
-      RequestContext.create(INSTANCE_NAME, APP_PROFILE_ID);
+      RequestContext.create(PROJECT_ID, INSTANCE_ID, APP_PROFILE_ID);
 
   private static final ByteString TEST_KEY = ByteString.copyFromUtf8("fake-key");
 
@@ -58,7 +56,7 @@ public void toProtoTest() {
     assertThat(actualProto)
         .isEqualTo(
             CheckAndMutateRowRequest.newBuilder()
-                .setTableName(TABLE_NAME.toString())
+                .setTableName(NameUtil.formatTableName(PROJECT_ID, INSTANCE_ID, TABLE_ID))
                 .setAppProfileId(APP_PROFILE_ID)
                 .setRowKey(TEST_KEY)
                 .build());
diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/QueryTest.java b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/QueryTest.java
index 85521bc2dbe9..780720fceea4 100644
--- a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/QueryTest.java
+++ b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/QueryTest.java
@@ -23,8 +23,8 @@
 import com.google.bigtable.v2.RowFilter;
 import com.google.bigtable.v2.RowRange;
 import com.google.bigtable.v2.RowSet;
-import com.google.bigtable.v2.TableName;
 import com.google.cloud.bigtable.data.v2.internal.ByteStringComparator;
+import com.google.cloud.bigtable.data.v2.internal.NameUtil;
 import com.google.cloud.bigtable.data.v2.internal.RequestContext;
 import com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange;
 import com.google.common.collect.ImmutableList;
@@ -44,21 +44,20 @@
 
 @RunWith(JUnit4.class)
 public class QueryTest {
-  private static final InstanceName INSTANCE_NAME =
-      InstanceName.of("fake-project", "fake-instance");
-  private static final TableName TABLE_NAME =
-      TableName.of("fake-project", "fake-instance", "fake-table");
+  private static final String PROJECT_ID = "fake-project";
+  private static final String INSTANCE_ID = "fake-instance";
+  private static final String TABLE_ID = "fake-table";
   private static final String APP_PROFILE_ID = "fake-profile-id";
   private RequestContext requestContext;
 
   @Before
   public void setUp() {
-    requestContext = RequestContext.create(INSTANCE_NAME, APP_PROFILE_ID);
+    requestContext = RequestContext.create(PROJECT_ID, INSTANCE_ID, APP_PROFILE_ID);
   }
 
   @Test
   public void requestContextTest() {
-    Query query = Query.create(TABLE_NAME.getTable());
+    Query query = Query.create(TABLE_ID);
 
     ReadRowsRequest proto = query.toProto(requestContext);
     assertThat(proto).isEqualTo(expectedProtoBuilder().build());
@@ -67,7 +66,7 @@ public void requestContextTest() {
   @Test
   public void rowKeysTest() {
     Query query =
-        Query.create(TABLE_NAME.getTable())
+        Query.create(TABLE_ID)
             .rowKey("simple-string")
             .rowKey(ByteString.copyFromUtf8("byte-string"));
 
@@ -84,7 +83,7 @@ public void rowKeysTest() {
   @Test
   public void rowRangeTest() {
     Query query =
-        Query.create(TABLE_NAME.getTable())
+        Query.create(TABLE_ID)
             .range("simple-begin", "simple-end")
             .range(ByteString.copyFromUtf8("byte-begin"), ByteString.copyFromUtf8("byte-end"))
             .range(ByteStringRange.create("range-begin", "range-end"));
@@ -111,7 +110,7 @@ public void rowRangeTest() {
 
   @Test
   public void filterTest() {
-    Query query = Query.create(TABLE_NAME.getTable()).filter(FILTERS.key().regex(".*"));
+    Query query = Query.create(TABLE_ID).filter(FILTERS.key().regex(".*"));
 
     Builder expectedProto =
         expectedProtoBuilder()
@@ -123,7 +122,7 @@ public void filterTest() {
 
   @Test
   public void limitTest() {
-    Query query = Query.create(TABLE_NAME.getTable()).limit(10);
+    Query query = Query.create(TABLE_ID).limit(10);
 
     Builder expectedProto = expectedProtoBuilder().setRowsLimit(10);
 
@@ -133,7 +132,7 @@ public void limitTest() {
 
   @Test
   public void serializationTest() throws IOException, ClassNotFoundException {
-    Query expected = Query.create(TABLE_NAME.getTable()).filter(FILTERS.key().regex(".*"));
+    Query expected = Query.create(TABLE_ID).filter(FILTERS.key().regex(".*"));
 
     ByteArrayOutputStream bos = new ByteArrayOutputStream();
     ObjectOutputStream oos = new ObjectOutputStream(bos);
@@ -148,7 +147,7 @@ public void serializationTest() throws IOException, ClassNotFoundException {
 
   @Test
   public void shardTestSplitPoints() {
-    Query query = Query.create(TABLE_NAME.getTable()).range("a", "z");
+    Query query = Query.create(TABLE_ID).range("a", "z");
 
     SortedSet splitPoints =
         ImmutableSortedSet.orderedBy(ByteStringComparator.INSTANCE)
@@ -161,7 +160,7 @@ public void shardTestSplitPoints() {
     assertThat(subQueries.get(0).toProto(requestContext))
         .isEqualTo(
             ReadRowsRequest.newBuilder()
-                .setTableName(TABLE_NAME.toString())
+                .setTableName(NameUtil.formatTableName(PROJECT_ID, INSTANCE_ID, TABLE_ID))
                 .setAppProfileId(APP_PROFILE_ID)
                 .setRows(
                     RowSet.newBuilder()
@@ -173,7 +172,7 @@ public void shardTestSplitPoints() {
     assertThat(subQueries.get(1).toProto(requestContext))
         .isEqualTo(
             ReadRowsRequest.newBuilder()
-                .setTableName(TABLE_NAME.toString())
+                .setTableName(NameUtil.formatTableName(PROJECT_ID, INSTANCE_ID, TABLE_ID))
                 .setAppProfileId(APP_PROFILE_ID)
                 .setRows(
                     RowSet.newBuilder()
@@ -186,7 +185,7 @@ public void shardTestSplitPoints() {
 
   @Test
   public void shardTestKeyOffsets() {
-    Query query = Query.create(TABLE_NAME.getTable()).range("a", "z");
+    Query query = Query.create(TABLE_ID).range("a", "z");
 
     List keyOffsets =
         ImmutableList.of(
@@ -199,7 +198,7 @@ public void shardTestKeyOffsets() {
     assertThat(subQueries.get(0).toProto(requestContext))
         .isEqualTo(
             ReadRowsRequest.newBuilder()
-                .setTableName(TABLE_NAME.toString())
+                .setTableName(NameUtil.formatTableName(PROJECT_ID, INSTANCE_ID, TABLE_ID))
                 .setAppProfileId(APP_PROFILE_ID)
                 .setRows(
                     RowSet.newBuilder()
@@ -211,7 +210,7 @@ public void shardTestKeyOffsets() {
     assertThat(subQueries.get(1).toProto(requestContext))
         .isEqualTo(
             ReadRowsRequest.newBuilder()
-                .setTableName(TABLE_NAME.toString())
+                .setTableName(NameUtil.formatTableName(PROJECT_ID, INSTANCE_ID, TABLE_ID))
                 .setAppProfileId(APP_PROFILE_ID)
                 .setRows(
                     RowSet.newBuilder()
@@ -224,7 +223,7 @@ public void shardTestKeyOffsets() {
 
   private static ReadRowsRequest.Builder expectedProtoBuilder() {
     return ReadRowsRequest.newBuilder()
-        .setTableName(TABLE_NAME.toString())
+        .setTableName(NameUtil.formatTableName(PROJECT_ID, INSTANCE_ID, TABLE_ID))
         .setAppProfileId(APP_PROFILE_ID);
   }
 }
diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/ReadModifyWriteRowTest.java b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/ReadModifyWriteRowTest.java
index 7d6d8563d093..a318a61f0ec9 100644
--- a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/ReadModifyWriteRowTest.java
+++ b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/ReadModifyWriteRowTest.java
@@ -19,7 +19,7 @@
 
 import com.google.bigtable.v2.ReadModifyWriteRowRequest;
 import com.google.bigtable.v2.ReadModifyWriteRule;
-import com.google.bigtable.v2.TableName;
+import com.google.cloud.bigtable.data.v2.internal.NameUtil;
 import com.google.cloud.bigtable.data.v2.internal.RequestContext;
 import com.google.protobuf.ByteString;
 import java.io.ByteArrayInputStream;
@@ -30,18 +30,17 @@
 import org.junit.Test;
 
 public class ReadModifyWriteRowTest {
-  private static final InstanceName INSTANCE_NAME =
-      InstanceName.of("fake-project", "fake-instance");
+  private static final String PROJECT_ID = "fake-project";
+  private static final String INSTANCE_ID = "fake-instance";
+  private static final String TABLE_ID = "fake-table";
   private static final String APP_PROFILE_ID = "fake-profile";
   private static final RequestContext REQUEST_CONTEXT =
-      RequestContext.create(INSTANCE_NAME, APP_PROFILE_ID);
-  private static final TableName TABLE_NAME =
-      TableName.of(INSTANCE_NAME.getProject(), INSTANCE_NAME.getInstance(), "fake-table");
+      RequestContext.create(PROJECT_ID, INSTANCE_ID, APP_PROFILE_ID);
 
   @Test
   public void testAppend() {
     ReadModifyWriteRow mutation =
-        ReadModifyWriteRow.create(TABLE_NAME.getTable(), "fake-key")
+        ReadModifyWriteRow.create(TABLE_ID, "fake-key")
             .append(
                 "fake-family",
                 ByteString.copyFromUtf8("fake-qualifier"),
@@ -52,7 +51,7 @@ public void testAppend() {
 
     ReadModifyWriteRowRequest expected =
         ReadModifyWriteRowRequest.newBuilder()
-            .setTableName(TABLE_NAME.toString())
+            .setTableName(NameUtil.formatTableName(PROJECT_ID, INSTANCE_ID, TABLE_ID))
             .setAppProfileId(APP_PROFILE_ID)
             .setRowKey(ByteString.copyFromUtf8("fake-key"))
             .addRules(
@@ -72,7 +71,7 @@ public void testAppend() {
   @Test
   public void testIncrement() {
     ReadModifyWriteRow mutation =
-        ReadModifyWriteRow.create(TABLE_NAME.getTable(), "fake-key")
+        ReadModifyWriteRow.create(TABLE_ID, "fake-key")
             .increment("fake-family", ByteString.copyFromUtf8("fake-qualifier"), 1)
             .increment("fake-family", "fake-qualifier-str", 2);
 
@@ -81,7 +80,7 @@ public void testIncrement() {
     assertThat(actualProto)
         .isEqualTo(
             ReadModifyWriteRowRequest.newBuilder()
-                .setTableName(TABLE_NAME.toString())
+                .setTableName(NameUtil.formatTableName(PROJECT_ID, INSTANCE_ID, TABLE_ID))
                 .setAppProfileId(APP_PROFILE_ID)
                 .setRowKey(ByteString.copyFromUtf8("fake-key"))
                 .addRules(
@@ -100,7 +99,7 @@ public void testIncrement() {
   @Test
   public void serializationTest() throws IOException, ClassNotFoundException {
     ReadModifyWriteRow expected =
-        ReadModifyWriteRow.create(TABLE_NAME.getTable(), "fake-key")
+        ReadModifyWriteRow.create(TABLE_ID, "fake-key")
             .increment("fake-family", ByteString.copyFromUtf8("fake-qualifier"), 1)
             .append("fake-family", "a", "b");
 
diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/RowMutationTest.java b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/RowMutationTest.java
index d38ef5bffe8b..1698449401b7 100644
--- a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/RowMutationTest.java
+++ b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/RowMutationTest.java
@@ -19,7 +19,7 @@
 
 import com.google.bigtable.v2.MutateRowRequest;
 import com.google.bigtable.v2.MutateRowsRequest;
-import com.google.bigtable.v2.TableName;
+import com.google.cloud.bigtable.data.v2.internal.NameUtil;
 import com.google.cloud.bigtable.data.v2.internal.RequestContext;
 import com.google.protobuf.ByteString;
 import java.io.ByteArrayInputStream;
@@ -33,11 +33,12 @@
 
 @RunWith(JUnit4.class)
 public class RowMutationTest {
-  private static final InstanceName INSTANCE_NAME =
-      InstanceName.of("fake-project", "fake-instance");
+  private static final String PROJECT_ID = "fake-project";
+  private static final String INSTANCE_ID = "fake-instance";
+  private static final String TABLE_ID = "fake-table";
   private static final String APP_PROFILE_ID = "fake-profile";
   private static final RequestContext REQUEST_CONTEXT =
-      RequestContext.create(INSTANCE_NAME, APP_PROFILE_ID);
+      RequestContext.create(PROJECT_ID, INSTANCE_ID, APP_PROFILE_ID);
 
   @Test
   public void toProtoTest() {
@@ -52,9 +53,7 @@ public void toProtoTest() {
         com.google.common.collect.Range.closed(timestampMin, System.currentTimeMillis() * 1_000);
 
     assertThat(actualRowMutation.getTableName())
-        .isEqualTo(
-            TableName.of(INSTANCE_NAME.getProject(), INSTANCE_NAME.getInstance(), "fake-table")
-                .toString());
+        .isEqualTo(NameUtil.formatTableName(PROJECT_ID, INSTANCE_ID, "fake-table"));
     assertThat(actualRowMutation.getAppProfileId()).isEqualTo(APP_PROFILE_ID);
     assertThat(actualRowMutation.getMutationsList()).hasSize(1);
     assertThat(actualRowMutation.getMutations(0).getSetCell().getValue())
@@ -77,9 +76,7 @@ public void toBulkProtoTest() {
         com.google.common.collect.Range.closed(timestampMin, System.currentTimeMillis() * 1_000);
 
     assertThat(actualRowMutation.getTableName())
-        .isEqualTo(
-            TableName.of(INSTANCE_NAME.getProject(), INSTANCE_NAME.getInstance(), "fake-table")
-                .toString());
+        .isEqualTo(NameUtil.formatTableName(PROJECT_ID, INSTANCE_ID, TABLE_ID));
     assertThat(actualRowMutation.getAppProfileId()).isEqualTo(APP_PROFILE_ID);
     assertThat(actualRowMutation.getEntriesList()).hasSize(1);
     assertThat(actualRowMutation.getEntries(0).getMutationsList()).hasSize(1);
diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/CheckAndMutateRowCallableTest.java b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/CheckAndMutateRowCallableTest.java
index cb9cfb2bf96d..5441f1d1f8ec 100644
--- a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/CheckAndMutateRowCallableTest.java
+++ b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/CheckAndMutateRowCallableTest.java
@@ -26,9 +26,9 @@
 import com.google.bigtable.v2.CheckAndMutateRowRequest;
 import com.google.bigtable.v2.CheckAndMutateRowResponse;
 import com.google.bigtable.v2.Mutation.DeleteFromRow;
+import com.google.cloud.bigtable.data.v2.internal.NameUtil;
 import com.google.cloud.bigtable.data.v2.internal.RequestContext;
 import com.google.cloud.bigtable.data.v2.models.ConditionalRowMutation;
-import com.google.cloud.bigtable.data.v2.models.InstanceName;
 import com.google.cloud.bigtable.data.v2.models.Mutation;
 import com.google.protobuf.ByteString;
 import io.grpc.Status.Code;
@@ -41,8 +41,9 @@
 
 @RunWith(JUnit4.class)
 public class CheckAndMutateRowCallableTest {
+
   private final RequestContext requestContext =
-      RequestContext.create(InstanceName.of("my-project", "my-instance"), "my-app-profile");
+      RequestContext.create("my-project", "my-instance", "my-app-profile");
   private FakeCallable inner;
   private CheckAndMutateRowCallable callable;
 
@@ -60,7 +61,9 @@ public void requestIsCorrect() {
     assertThat(inner.request)
         .isEqualTo(
             CheckAndMutateRowRequest.newBuilder()
-                .setTableName(requestContext.getInstanceName() + "/tables/my-table")
+                .setTableName(
+                    NameUtil.formatTableName(
+                        requestContext.getProjectId(), requestContext.getInstanceId(), "my-table"))
                 .setRowKey(ByteString.copyFromUtf8("row-key"))
                 .setAppProfileId(requestContext.getAppProfileId())
                 .addTrueMutations(
diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettingsTest.java b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettingsTest.java
index def90578cad5..017eb2ab0312 100644
--- a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettingsTest.java
+++ b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettingsTest.java
@@ -27,7 +27,6 @@
 import com.google.api.gax.rpc.UnaryCallSettings;
 import com.google.api.gax.rpc.WatchdogProvider;
 import com.google.cloud.bigtable.data.v2.models.ConditionalRowMutation;
-import com.google.cloud.bigtable.data.v2.models.InstanceName;
 import com.google.cloud.bigtable.data.v2.models.KeyOffset;
 import com.google.cloud.bigtable.data.v2.models.Query;
 import com.google.cloud.bigtable.data.v2.models.Row;
@@ -59,7 +58,8 @@ public void instanceNameIsRequiredTest() {
 
   @Test
   public void settingsAreNotLostTest() {
-    InstanceName instanceName = InstanceName.of("my-project", "my-instance");
+    String projectId = "my-project";
+    String instanceId = "my-instance";
     String appProfileId = "my-app-profile-id";
     String endpoint = "some.other.host:123";
     CredentialsProvider credentialsProvider = Mockito.mock(CredentialsProvider.class);
@@ -68,7 +68,8 @@ public void settingsAreNotLostTest() {
 
     EnhancedBigtableStubSettings.Builder builder =
         EnhancedBigtableStubSettings.newBuilder()
-            .setInstanceName(instanceName)
+            .setProjectId(projectId)
+            .setInstanceId(instanceId)
             .setAppProfileId(appProfileId)
             .setEndpoint(endpoint)
             .setCredentialsProvider(credentialsProvider)
@@ -77,7 +78,8 @@ public void settingsAreNotLostTest() {
 
     verifyBuilder(
         builder,
-        instanceName,
+        projectId,
+        instanceId,
         appProfileId,
         endpoint,
         credentialsProvider,
@@ -85,7 +87,8 @@ public void settingsAreNotLostTest() {
         watchdogInterval);
     verifySettings(
         builder.build(),
-        instanceName,
+        projectId,
+        instanceId,
         appProfileId,
         endpoint,
         credentialsProvider,
@@ -93,7 +96,8 @@ public void settingsAreNotLostTest() {
         watchdogInterval);
     verifyBuilder(
         builder.build().toBuilder(),
-        instanceName,
+        projectId,
+        instanceId,
         appProfileId,
         endpoint,
         credentialsProvider,
@@ -103,13 +107,15 @@ public void settingsAreNotLostTest() {
 
   private void verifyBuilder(
       EnhancedBigtableStubSettings.Builder builder,
-      InstanceName instanceName,
+      String projectId,
+      String instanceId,
       String appProfileId,
       String endpoint,
       CredentialsProvider credentialsProvider,
       WatchdogProvider watchdogProvider,
       Duration watchdogInterval) {
-    assertThat(builder.getInstanceName()).isEqualTo(instanceName);
+    assertThat(builder.getProjectId()).isEqualTo(projectId);
+    assertThat(builder.getInstanceId()).isEqualTo(instanceId);
     assertThat(builder.getAppProfileId()).isEqualTo(appProfileId);
     assertThat(builder.getEndpoint()).isEqualTo(endpoint);
     assertThat(builder.getCredentialsProvider()).isEqualTo(credentialsProvider);
@@ -119,13 +125,15 @@ private void verifyBuilder(
 
   private void verifySettings(
       EnhancedBigtableStubSettings settings,
-      InstanceName instanceName,
+      String projectId,
+      String instanceId,
       String appProfileId,
       String endpoint,
       CredentialsProvider credentialsProvider,
       WatchdogProvider watchdogProvider,
       Duration watchdogInterval) {
-    assertThat(settings.getInstanceName()).isEqualTo(instanceName);
+    assertThat(settings.getProjectId()).isEqualTo(projectId);
+    assertThat(settings.getInstanceId()).isEqualTo(instanceId);
     assertThat(settings.getAppProfileId()).isEqualTo(appProfileId);
     assertThat(settings.getEndpoint()).isEqualTo(endpoint);
     assertThat(settings.getCredentialsProvider()).isEqualTo(credentialsProvider);
@@ -135,10 +143,13 @@ private void verifySettings(
 
   @Test
   public void multipleChannelsByDefaultTest() {
-    InstanceName dummyInstanceName = InstanceName.of("my-project", "my-instance");
+    String dummyProjectId = "my-project";
+    String dummyInstanceId = "my-instance";
 
     EnhancedBigtableStubSettings.Builder builder =
-        EnhancedBigtableStubSettings.newBuilder().setInstanceName(dummyInstanceName);
+        EnhancedBigtableStubSettings.newBuilder()
+            .setProjectId(dummyProjectId)
+            .setInstanceId(dummyInstanceId);
 
     InstantiatingGrpcChannelProvider provider =
         (InstantiatingGrpcChannelProvider) builder.getTransportChannelProvider();
@@ -148,10 +159,13 @@ public void multipleChannelsByDefaultTest() {
 
   @Test
   public void readRowsIsNotLostTest() {
-    InstanceName dummyInstanceName = InstanceName.of("my-project", "my-instance");
+    String dummyProjectId = "my-project";
+    String dummyInstanceId = "my-instance";
 
     EnhancedBigtableStubSettings.Builder builder =
-        EnhancedBigtableStubSettings.newBuilder().setInstanceName(dummyInstanceName);
+        EnhancedBigtableStubSettings.newBuilder()
+            .setProjectId(dummyProjectId)
+            .setInstanceId(dummyInstanceId);
 
     RetrySettings retrySettings =
         RetrySettings.newBuilder()
@@ -202,10 +216,10 @@ public void readRowsHasSaneDefaultsTest() {
 
   @Test
   public void readRowIsNotLostTest() {
-    InstanceName dummyInstanceName = InstanceName.of("my-project", "my-instance");
-
     EnhancedBigtableStubSettings.Builder builder =
-        EnhancedBigtableStubSettings.newBuilder().setInstanceName(dummyInstanceName);
+        EnhancedBigtableStubSettings.newBuilder()
+            .setProjectId("my-project")
+            .setInstanceId("my-instance");
 
     RetrySettings retrySettings =
         RetrySettings.newBuilder()
@@ -250,10 +264,10 @@ public void readRowHasSaneDefaultsTest() {
 
   @Test
   public void readRowRetryCodesMustMatch() {
-    InstanceName dummyInstanceName = InstanceName.of("my-project", "my-instance");
-
     EnhancedBigtableStubSettings.Builder builder =
-        EnhancedBigtableStubSettings.newBuilder().setInstanceName(dummyInstanceName);
+        EnhancedBigtableStubSettings.newBuilder()
+            .setProjectId("my-project")
+            .setInstanceId("my-instance");
 
     builder.readRowsSettings().setRetryableCodes(Code.DEADLINE_EXCEEDED);
 
@@ -280,10 +294,13 @@ public void readRowRetryCodesMustMatch() {
 
   @Test
   public void sampleRowKeysSettingsAreNotLostTest() {
-    InstanceName dummyInstanceName = InstanceName.of("my-project", "my-instance");
+    String dummyProjectId = "my-project";
+    String dummyInstanceId = "my-instance";
 
     EnhancedBigtableStubSettings.Builder builder =
-        EnhancedBigtableStubSettings.newBuilder().setInstanceName(dummyInstanceName);
+        EnhancedBigtableStubSettings.newBuilder()
+            .setProjectId(dummyProjectId)
+            .setInstanceId(dummyInstanceId);
 
     RetrySettings retrySettings =
         RetrySettings.newBuilder()
@@ -324,10 +341,13 @@ public void sampleRowKeysHasSaneDefaultsTest() {
 
   @Test
   public void mutateRowSettingsAreNotLostTest() {
-    InstanceName dummyInstanceName = InstanceName.of("my-project", "my-instance");
+    String dummyProjectId = "my-project";
+    String dummyInstanceId = "my-instance";
 
     EnhancedBigtableStubSettings.Builder builder =
-        EnhancedBigtableStubSettings.newBuilder().setInstanceName(dummyInstanceName);
+        EnhancedBigtableStubSettings.newBuilder()
+            .setProjectId(dummyProjectId)
+            .setInstanceId(dummyInstanceId);
 
     RetrySettings retrySettings =
         RetrySettings.newBuilder()
@@ -368,10 +388,13 @@ public void mutateRowHasSaneDefaultsTest() {
 
   @Test
   public void bulkMutateRowsSettingsAreNotLostTest() {
-    InstanceName dummyInstanceName = InstanceName.of("my-project", "my-instance");
+    String dummyProjectId = "my-project";
+    String dummyInstanceId = "my-instance";
 
     EnhancedBigtableStubSettings.Builder builder =
-        EnhancedBigtableStubSettings.newBuilder().setInstanceName(dummyInstanceName);
+        EnhancedBigtableStubSettings.newBuilder()
+            .setProjectId(dummyProjectId)
+            .setInstanceId(dummyInstanceId);
 
     RetrySettings retrySettings =
         RetrySettings.newBuilder()
@@ -436,10 +459,13 @@ public void mutateRowsHasSaneDefaultsTest() {
 
   @Test
   public void checkAndMutateRowSettingsAreNotLostTest() {
-    InstanceName dummyInstanceName = InstanceName.of("my-project", "my-instance");
+    String dummyProjectId = "my-project";
+    String dummyInstanceId = "my-instance";
 
     EnhancedBigtableStubSettings.Builder builder =
-        EnhancedBigtableStubSettings.newBuilder().setInstanceName(dummyInstanceName);
+        EnhancedBigtableStubSettings.newBuilder()
+            .setProjectId(dummyProjectId)
+            .setInstanceId(dummyInstanceId);
 
     RetrySettings retrySettings = RetrySettings.newBuilder().build();
     builder
diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/MutateRowCallableTest.java b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/MutateRowCallableTest.java
index aac06f077486..2b688292576b 100644
--- a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/MutateRowCallableTest.java
+++ b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/MutateRowCallableTest.java
@@ -21,7 +21,6 @@
 import com.google.bigtable.v2.MutateRowRequest;
 import com.google.bigtable.v2.MutateRowResponse;
 import com.google.cloud.bigtable.data.v2.internal.RequestContext;
-import com.google.cloud.bigtable.data.v2.models.InstanceName;
 import com.google.cloud.bigtable.data.v2.models.RowMutation;
 import com.google.common.truth.Truth;
 import org.junit.Before;
@@ -35,7 +34,7 @@
 public class MutateRowCallableTest {
 
   private static final RequestContext REQUEST_CONTEXT =
-      RequestContext.create(InstanceName.of("fake-project", "fake-instance"), "fake-profile");
+      RequestContext.create("fake-project", "fake-instance", "fake-profile");
   private UnaryCallable innerCallable;
   private ArgumentCaptor innerMutation;
   private SettableApiFuture innerResult;
diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/ReadModifyWriteRowCallableTest.java b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/ReadModifyWriteRowCallableTest.java
index a91325de3237..76dabd159303 100644
--- a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/ReadModifyWriteRowCallableTest.java
+++ b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/ReadModifyWriteRowCallableTest.java
@@ -29,8 +29,8 @@
 import com.google.bigtable.v2.ReadModifyWriteRowRequest;
 import com.google.bigtable.v2.ReadModifyWriteRowResponse;
 import com.google.bigtable.v2.ReadModifyWriteRule;
+import com.google.cloud.bigtable.data.v2.internal.NameUtil;
 import com.google.cloud.bigtable.data.v2.internal.RequestContext;
-import com.google.cloud.bigtable.data.v2.models.InstanceName;
 import com.google.cloud.bigtable.data.v2.models.ReadModifyWriteRow;
 import com.google.cloud.bigtable.data.v2.models.Row;
 import com.google.cloud.bigtable.data.v2.models.RowCell;
@@ -47,7 +47,7 @@
 @RunWith(JUnit4.class)
 public class ReadModifyWriteRowCallableTest {
   private final RequestContext requestContext =
-      RequestContext.create(InstanceName.of("my-project", "my-instance"), "my-app-profile");
+      RequestContext.create("fake-project", "fake-instance", "fake-profile");
   private FakeCallable inner;
   private ReadModifyWriteRowCallable callable;
 
@@ -65,7 +65,9 @@ public void requestIsCorrect() {
     assertThat(inner.request)
         .isEqualTo(
             ReadModifyWriteRowRequest.newBuilder()
-                .setTableName(requestContext.getInstanceName() + "/tables/my-table")
+                .setTableName(
+                    NameUtil.formatTableName(
+                        requestContext.getProjectId(), requestContext.getInstanceId(), "my-table"))
                 .setAppProfileId(requestContext.getAppProfileId())
                 .setRowKey(ByteString.copyFromUtf8("my-key"))
                 .addRules(
diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/ResourceHeaderTest.java b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/ResourceHeaderTest.java
index 275e801e4e5f..8acb7cde9b17 100644
--- a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/ResourceHeaderTest.java
+++ b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/ResourceHeaderTest.java
@@ -21,13 +21,12 @@
 import com.google.api.gax.grpc.testing.InProcessServer;
 import com.google.api.gax.grpc.testing.LocalChannelProvider;
 import com.google.bigtable.v2.BigtableGrpc;
-import com.google.bigtable.v2.TableName;
 import com.google.cloud.bigtable.data.v2.BigtableDataClient;
 import com.google.cloud.bigtable.data.v2.BigtableDataSettings;
+import com.google.cloud.bigtable.data.v2.internal.NameUtil;
 import com.google.cloud.bigtable.data.v2.models.BulkMutationBatcher;
 import com.google.cloud.bigtable.data.v2.models.BulkMutationBatcher.BulkMutationFailure;
 import com.google.cloud.bigtable.data.v2.models.ConditionalRowMutation;
-import com.google.cloud.bigtable.data.v2.models.InstanceName;
 import com.google.cloud.bigtable.data.v2.models.Mutation;
 import com.google.cloud.bigtable.data.v2.models.Query;
 import com.google.cloud.bigtable.data.v2.models.ReadModifyWriteRow;
@@ -42,11 +41,12 @@
 
 @RunWith(JUnit4.class)
 public class ResourceHeaderTest {
+  private static final String PROJECT_ID = "fake-project";
+  private static final String INSTANCE_ID = "fake-instance";
+  private static final String TABLE_ID = "fake-table";
   private static final String NAME = "resource-header-test:123";
-  private static final TableName TABLE_NAME =
-      TableName.of("fake-project", "fake-instance", "fake-table");
   private static final Pattern EXPECTED_HEADER_PATTERN =
-      Pattern.compile(".*" + TABLE_NAME.toString() + ".*");
+      Pattern.compile(".*" + NameUtil.formatTableName(PROJECT_ID, INSTANCE_ID, TABLE_ID) + ".*");
   private static final String HEADER_NAME = "x-goog-request-params";
 
   private InProcessServer server;
@@ -61,7 +61,8 @@ public void setUp() throws Exception {
 
     BigtableDataSettings.Builder settings =
         BigtableDataSettings.newBuilder()
-            .setInstanceName(InstanceName.of(TABLE_NAME.getProject(), TABLE_NAME.getInstance()))
+            .setProjectId(PROJECT_ID)
+            .setInstanceId(INSTANCE_ID)
             .setTransportChannelProvider(channelProvider)
             .setCredentialsProvider(NoCredentialsProvider.create());
 
@@ -88,26 +89,26 @@ public void tearDown() throws Exception {
 
   @Test
   public void readRowsTest() {
-    client.readRows(Query.create(TABLE_NAME.getTable()));
+    client.readRows(Query.create(TABLE_ID));
     verifyHeaderSent();
   }
 
   @Test
   public void sampleRowKeysTest() {
-    client.sampleRowKeysAsync(TABLE_NAME.getTable());
+    client.sampleRowKeysAsync(TABLE_ID);
     verifyHeaderSent();
   }
 
   @Test
   public void mutateRowTest() {
-    client.mutateRowAsync(RowMutation.create(TABLE_NAME.getTable(), "fake-key").deleteRow());
+    client.mutateRowAsync(RowMutation.create(TABLE_ID, "fake-key").deleteRow());
     verifyHeaderSent();
   }
 
   @Test
   public void mutateRowsTest() throws TimeoutException, InterruptedException {
     try (BulkMutationBatcher batcher = client.newBulkMutationBatcher()) {
-      batcher.add(RowMutation.create(TABLE_NAME.getTable(), "fake-key").deleteRow());
+      batcher.add(RowMutation.create(TABLE_ID, "fake-key").deleteRow());
     } catch (BulkMutationFailure e) {
       // Ignore the errors: none of the methods are actually implemented
     }
@@ -117,15 +118,14 @@ public void mutateRowsTest() throws TimeoutException, InterruptedException {
   @Test
   public void checkAndMutateRowTest() {
     client.checkAndMutateRowAsync(
-        ConditionalRowMutation.create(TABLE_NAME.getTable(), "fake-key")
-            .then(Mutation.create().deleteRow()));
+        ConditionalRowMutation.create(TABLE_ID, "fake-key").then(Mutation.create().deleteRow()));
     verifyHeaderSent();
   }
 
   @Test
   public void readModifyWriteTest() {
     client.readModifyWriteRowAsync(
-        ReadModifyWriteRow.create(TABLE_NAME.getTable(), "fake-key").increment("cf", "q", 1));
+        ReadModifyWriteRow.create(TABLE_ID, "fake-key").increment("cf", "q", 1));
     verifyHeaderSent();
   }
 
diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/SampleRowKeysCallableTest.java b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/SampleRowKeysCallableTest.java
index 1482eee96fff..40a30d326393 100644
--- a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/SampleRowKeysCallableTest.java
+++ b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/SampleRowKeysCallableTest.java
@@ -25,8 +25,8 @@
 import com.google.api.gax.rpc.UnaryCallable;
 import com.google.bigtable.v2.SampleRowKeysRequest;
 import com.google.bigtable.v2.SampleRowKeysResponse;
+import com.google.cloud.bigtable.data.v2.internal.NameUtil;
 import com.google.cloud.bigtable.data.v2.internal.RequestContext;
-import com.google.cloud.bigtable.data.v2.models.InstanceName;
 import com.google.cloud.bigtable.data.v2.models.KeyOffset;
 import com.google.common.collect.ImmutableList;
 import com.google.protobuf.ByteString;
@@ -41,8 +41,9 @@
 
 @RunWith(JUnit4.class)
 public class SampleRowKeysCallableTest {
+
   private final RequestContext requestContext =
-      RequestContext.create(InstanceName.of("my-project", "my-instance"), "my-app-profile");
+      RequestContext.create("my-project", "my-instance", "my-profile");
   private FakeCallable inner;
   private SampleRowKeysCallable callable;
 
@@ -59,7 +60,9 @@ public void requestIsCorrect() {
     assertThat(inner.request)
         .isEqualTo(
             SampleRowKeysRequest.newBuilder()
-                .setTableName(requestContext.getInstanceName() + "/tables/my-table")
+                .setTableName(
+                    NameUtil.formatTableName(
+                        requestContext.getProjectId(), requestContext.getInstanceId(), "my-table"))
                 .setAppProfileId(requestContext.getAppProfileId())
                 .build());
   }
diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/mutaterows/BulkMutateRowsRetryTest.java b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/mutaterows/BulkMutateRowsRetryTest.java
index ea3aae3ba214..10528d333d27 100644
--- a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/mutaterows/BulkMutateRowsRetryTest.java
+++ b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/mutaterows/BulkMutateRowsRetryTest.java
@@ -30,11 +30,9 @@
 import com.google.bigtable.v2.MutateRowsRequest;
 import com.google.bigtable.v2.MutateRowsRequest.Entry;
 import com.google.bigtable.v2.MutateRowsResponse;
-import com.google.bigtable.v2.TableName;
 import com.google.cloud.bigtable.data.v2.BigtableDataClient;
 import com.google.cloud.bigtable.data.v2.BigtableDataSettings;
 import com.google.cloud.bigtable.data.v2.models.BulkMutationBatcher;
-import com.google.cloud.bigtable.data.v2.models.InstanceName;
 import com.google.cloud.bigtable.data.v2.models.RowMutation;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Queues;
@@ -56,11 +54,9 @@
 
 @RunWith(MockitoJUnitRunner.class)
 public class BulkMutateRowsRetryTest {
-  private static final InstanceName INSTANCE_NAME =
-      InstanceName.of("fake-project", "fake-instance");
-  private static final TableName TABLE_NAME =
-      TableName.of(INSTANCE_NAME.getProject(), INSTANCE_NAME.getInstance(), "fake-table");
-  private static final String TABLE_ID = TABLE_NAME.getTable();
+  private static final String PROJECT_ID = "fake-project";
+  private static final String INSTANCE_ID = "fake-instance";
+  private static final String TABLE_ID = "fake-table";
 
   private static final int MAX_ATTEMPTS = 5;
   private static final long FLUSH_COUNT = 10;
@@ -78,7 +74,8 @@ public void setUp() throws Exception {
 
     BigtableDataSettings.Builder settings =
         BigtableDataSettings.newBuilder()
-            .setInstanceName(INSTANCE_NAME)
+            .setProjectId(PROJECT_ID)
+            .setInstanceId(INSTANCE_ID)
             .setCredentialsProvider(NoCredentialsProvider.create())
             .setTransportChannelProvider(
                 FixedTransportChannelProvider.create(
diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/mutaterows/MutateRowsBatchingDescriptorTest.java b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/mutaterows/MutateRowsBatchingDescriptorTest.java
index 67d4ebf0a0a6..3178e82894d1 100644
--- a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/mutaterows/MutateRowsBatchingDescriptorTest.java
+++ b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/mutaterows/MutateRowsBatchingDescriptorTest.java
@@ -30,7 +30,7 @@
 import com.google.bigtable.v2.MutateRowsRequest.Entry.Builder;
 import com.google.bigtable.v2.Mutation;
 import com.google.bigtable.v2.Mutation.SetCell;
-import com.google.bigtable.v2.TableName;
+import com.google.cloud.bigtable.data.v2.internal.NameUtil;
 import com.google.cloud.bigtable.data.v2.models.MutateRowsException;
 import com.google.cloud.bigtable.data.v2.models.MutateRowsException.FailedMutation;
 import com.google.common.collect.ImmutableList;
@@ -48,8 +48,9 @@
 
 @RunWith(JUnit4.class)
 public class MutateRowsBatchingDescriptorTest {
-  private static final TableName TABLE_NAME =
-      TableName.of("fake-project", "fake-instance", "fake-table");
+  private static final String PROJECT_ID = "fake-project";
+  private static final String INSTANCE_ID = "fake-instance";
+  private static final String TABLE_ID = "fake-table";
 
   private MutateRowsBatchingDescriptor descriptor;
 
@@ -74,13 +75,12 @@ public void countElementsTest() {
 
   @Test
   public void partitionKeyTest() {
-    TableName myTableName = TableName.of("my-project", "my-instance", "my-table");
+    String myTableName = NameUtil.formatTableName("my-project", "my-instance", "my-table");
 
-    MutateRowsRequest request =
-        createRequest(2).toBuilder().setTableName(myTableName.toString()).build();
+    MutateRowsRequest request = createRequest(2).toBuilder().setTableName(myTableName).build();
 
     PartitionKey actual = descriptor.getBatchPartitionKey(request);
-    assertThat(actual).isEqualTo(new PartitionKey(myTableName.toString()));
+    assertThat(actual).isEqualTo(new PartitionKey(myTableName));
   }
 
   @Test
@@ -92,7 +92,7 @@ public void requestBuilderTest() {
     for (Entry entry : expected.getEntriesList()) {
       MutateRowsRequest singleReq =
           MutateRowsRequest.newBuilder()
-              .setTableName(TABLE_NAME.toString())
+              .setTableName(NameUtil.formatTableName(PROJECT_ID, INSTANCE_ID, TABLE_ID))
               .addEntries(entry)
               .build();
 
@@ -205,7 +205,8 @@ public void splitResponseOkTest()
 
   private static MutateRowsRequest createRequest(int count) {
     MutateRowsRequest.Builder request =
-        MutateRowsRequest.newBuilder().setTableName(TABLE_NAME.toString());
+        MutateRowsRequest.newBuilder()
+            .setTableName(NameUtil.formatTableName(PROJECT_ID, INSTANCE_ID, TABLE_ID));
 
     for (int i = 0; i < count; i++) {
       Builder entry =
diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/readrows/ReadRowsFirstCallableTest.java b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/readrows/ReadRowsFirstCallableTest.java
index 17cdf380e701..e7fb90941ec0 100644
--- a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/readrows/ReadRowsFirstCallableTest.java
+++ b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/readrows/ReadRowsFirstCallableTest.java
@@ -19,7 +19,6 @@
 import com.google.api.gax.rpc.ApiCallContext;
 import com.google.api.gax.rpc.UnaryCallable;
 import com.google.cloud.bigtable.data.v2.internal.RequestContext;
-import com.google.cloud.bigtable.data.v2.models.InstanceName;
 import com.google.cloud.bigtable.data.v2.models.Query;
 import com.google.cloud.bigtable.data.v2.models.Row;
 import com.google.common.truth.Truth;
@@ -33,7 +32,7 @@
 @RunWith(JUnit4.class)
 public class ReadRowsFirstCallableTest {
   private static final RequestContext REQUEST_CONTEXT =
-      RequestContext.create(InstanceName.of("fake-project", "fake-instance"), "fake-profile");;
+      RequestContext.create("fake-project", "fake-instance", "fake-profile");
   private UnaryCallable innerCallable;
   private ArgumentCaptor innerQuery;
   private SettableApiFuture innerResult;
diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/readrows/ReadRowsRetryTest.java b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/readrows/ReadRowsRetryTest.java
index 5188405578ed..12c01275cfe1 100644
--- a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/readrows/ReadRowsRetryTest.java
+++ b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/readrows/ReadRowsRetryTest.java
@@ -25,10 +25,9 @@
 import com.google.bigtable.v2.ReadRowsResponse;
 import com.google.bigtable.v2.ReadRowsResponse.CellChunk;
 import com.google.bigtable.v2.RowRange;
-import com.google.bigtable.v2.TableName;
 import com.google.cloud.bigtable.data.v2.BigtableDataClient;
 import com.google.cloud.bigtable.data.v2.BigtableDataSettings;
-import com.google.cloud.bigtable.data.v2.models.InstanceName;
+import com.google.cloud.bigtable.data.v2.internal.NameUtil;
 import com.google.cloud.bigtable.data.v2.models.Query;
 import com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange;
 import com.google.cloud.bigtable.data.v2.models.Row;
@@ -54,10 +53,9 @@
 
 @RunWith(MockitoJUnitRunner.class)
 public class ReadRowsRetryTest {
-  private static final InstanceName instanceName = InstanceName.of("fake-project", "fake-instance");
-
-  private static final TableName tableName =
-      TableName.of(instanceName.getProject(), instanceName.getInstance(), "fake-table");
+  private static final String PROJECT_ID = "fake-project";
+  private static final String INSTANCE_ID = "fake-instance";
+  private static final String TABLE_ID = "fake-table";
 
   @Rule public GrpcServerRule serverRule = new GrpcServerRule();
   private TestBigtableService service;
@@ -70,7 +68,8 @@ public void setUp() throws IOException {
 
     BigtableDataSettings settings =
         BigtableDataSettings.newBuilder()
-            .setInstanceName(instanceName)
+            .setProjectId(PROJECT_ID)
+            .setInstanceId(INSTANCE_ID)
             .setCredentialsProvider(NoCredentialsProvider.create())
             .setTransportChannelProvider(
                 FixedTransportChannelProvider.create(
@@ -93,8 +92,7 @@ public void happyPathTest() {
             .expectRequest(Range.closedOpen("r1", "r3"))
             .respondWith("k1", "r1", "r2"));
 
-    List actualResults =
-        getResults(Query.create(tableName.getTable()).rowKey("k1").range("r1", "r3"));
+    List actualResults = getResults(Query.create(TABLE_ID).rowKey("k1").range("r1", "r3"));
     Truth.assertThat(actualResults).containsExactly("k1", "r1", "r2").inOrder();
   }
 
@@ -111,8 +109,7 @@ public void immediateRetryTest() {
             .expectRequest(Range.closedOpen("r1", "r3"))
             .respondWith("k1", "r1", "r2"));
 
-    List actualResults =
-        getResults(Query.create(tableName.getTable()).rowKey("k1").range("r1", "r3"));
+    List actualResults = getResults(Query.create(TABLE_ID).rowKey("k1").range("r1", "r3"));
     Truth.assertThat(actualResults).containsExactly("k1", "r1", "r2").inOrder();
   }
 
@@ -135,7 +132,7 @@ public void multipleRetryTest() {
     service.expectations.add(
         RpcExpectation.create().expectRequest(Range.open("r7", "r9")).respondWith("r8"));
 
-    List actualResults = getResults(Query.create(tableName.getTable()).range("r1", "r9"));
+    List actualResults = getResults(Query.create(TABLE_ID).range("r1", "r9"));
     Truth.assertThat(actualResults)
         .containsExactly("r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8")
         .inOrder();
@@ -155,8 +152,7 @@ public void rowLimitTest() {
             .expectRowLimit(1)
             .respondWith("r2"));
 
-    List actualResults =
-        getResults(Query.create(tableName.getTable()).range("r1", "r3").limit(2));
+    List actualResults = getResults(Query.create(TABLE_ID).range("r1", "r3").limit(2));
     Truth.assertThat(actualResults).containsExactly("r1", "r2").inOrder();
   }
 
@@ -171,8 +167,7 @@ public void errorAfterRowLimitMetTest() {
 
     // Second retry request is handled locally in ReadRowsRetryCompletedCallable
 
-    List actualResults =
-        getResults(Query.create(tableName.getTable()).range("r1", "r3").limit(2));
+    List actualResults = getResults(Query.create(TABLE_ID).range("r1", "r3").limit(2));
 
     Truth.assertThat(actualResults).containsExactly("r1", "r2");
   }
@@ -188,8 +183,7 @@ public void errorAfterRequestCompleteTest() {
 
     // Second retry request is handled locally in ReadRowsRetryCompletedCallable
 
-    List actualResults =
-        getResults(Query.create(tableName.getTable()).range("r1", "r3").rowKey("r4"));
+    List actualResults = getResults(Query.create(TABLE_ID).range("r1", "r3").rowKey("r4"));
 
     Truth.assertThat(actualResults).containsExactly("r2", "r4");
   }
@@ -203,8 +197,7 @@ public void pointTest() {
             .respondWithStatus(Code.UNAVAILABLE));
     service.expectations.add(RpcExpectation.create().expectRequest("r2").respondWith("r2"));
 
-    List actualResults =
-        getResults(Query.create(tableName.getTable()).rowKey("r1").rowKey("r2"));
+    List actualResults = getResults(Query.create(TABLE_ID).rowKey("r1").rowKey("r2"));
     Truth.assertThat(actualResults).containsExactly("r1", "r2").inOrder();
   }
 
@@ -214,7 +207,7 @@ public void fullTableScanTest() {
         RpcExpectation.create().respondWith("r1").respondWithStatus(Code.UNAVAILABLE));
     service.expectations.add(
         RpcExpectation.create().expectRequest(Range.greaterThan("r1")).respondWith("r2"));
-    List actualResults = getResults(Query.create(tableName.getTable()));
+    List actualResults = getResults(Query.create(TABLE_ID));
     Truth.assertThat(actualResults).containsExactly("r1", "r2").inOrder();
   }
 
@@ -229,8 +222,7 @@ public void retryUnboundedStartTest() {
         RpcExpectation.create().expectRequest(Range.open("r1", "r9")).respondWith("r2"));
 
     List actualResults =
-        getResults(
-            Query.create(tableName.getTable()).range(ByteStringRange.unbounded().endOpen("r9")));
+        getResults(Query.create(TABLE_ID).range(ByteStringRange.unbounded().endOpen("r9")));
     Truth.assertThat(actualResults).containsExactly("r1", "r2").inOrder();
   }
 
@@ -245,9 +237,7 @@ public void retryUnboundedEndTest() {
         RpcExpectation.create().expectRequest(Range.greaterThan("r1")).respondWith("r2"));
 
     List actualResults =
-        getResults(
-            Query.create(tableName.getTable())
-                .range(ByteStringRange.unbounded().startClosed("r1")));
+        getResults(Query.create(TABLE_ID).range(ByteStringRange.unbounded().startClosed("r1")));
     Truth.assertThat(actualResults).containsExactly("r1", "r2").inOrder();
   }
 
@@ -261,7 +251,7 @@ public void retryWithLastScannedKeyTest() {
     service.expectations.add(
         RpcExpectation.create().expectRequest(Range.open("r5", "r9")).respondWith("r7"));
     List actualResults =
-        getResults(Query.create(tableName.getTable()).range(ByteStringRange.create("r1", "r9")));
+        getResults(Query.create(TABLE_ID).range(ByteStringRange.create("r1", "r9")));
     Truth.assertThat(actualResults).containsExactly("r7").inOrder();
   }
 
@@ -309,7 +299,9 @@ private static class RpcExpectation {
     List responses;
 
     private RpcExpectation() {
-      this.requestBuilder = ReadRowsRequest.newBuilder().setTableName(tableName.toString());
+      this.requestBuilder =
+          ReadRowsRequest.newBuilder()
+              .setTableName(NameUtil.formatTableName(PROJECT_ID, INSTANCE_ID, TABLE_ID));
       this.statusCode = Status.Code.OK;
       this.responses = Lists.newArrayList();
     }
diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/readrows/ReadRowsUserCallableTest.java b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/readrows/ReadRowsUserCallableTest.java
index 8a0e2de9990c..d1e03df2c660 100644
--- a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/readrows/ReadRowsUserCallableTest.java
+++ b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/readrows/ReadRowsUserCallableTest.java
@@ -17,7 +17,6 @@
 
 import com.google.bigtable.v2.ReadRowsRequest;
 import com.google.cloud.bigtable.data.v2.internal.RequestContext;
-import com.google.cloud.bigtable.data.v2.models.InstanceName;
 import com.google.cloud.bigtable.data.v2.models.Query;
 import com.google.cloud.bigtable.data.v2.models.Row;
 import com.google.cloud.bigtable.gaxx.testing.FakeStreamingApi.ServerStreamingStashCallable;
@@ -29,7 +28,7 @@
 @RunWith(JUnit4.class)
 public class ReadRowsUserCallableTest {
   private static final RequestContext REQUEST_CONTEXT =
-      RequestContext.create(InstanceName.of("fake-project", "fake-instance"), "fake-profile");
+      RequestContext.create("fake-project", "fake-instance", "fake-profile");
 
   @Test
   public void testRequestConverted() {