title: Azure Cosmos DB Number of Columns Limit
body: <p>The <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Understanding-the-Table-Service-Data-Model" rel="nofollow noreferrer">Azure Table Service documentation</a> states that entities (rows) must have at most 255 properties, which I understand to mean these tables can have at most 255 columns, which seems highly restrictive.</p>
  
  <p>Two questions: first, do the same limits apply to Cosmos DB Table Storage? I can't seem to find any documentation that says one way or another, though the language of "entities" is still used. And second--if the same limit applies in Cosmos DB--is there any useful way around this limit for storage and querying, along the lines of <a href="https://docs.microsoft.com/en-us/sql/relational-databases/json/json-data-sql-server?view=sql-server-2017" rel="nofollow noreferrer">JSON in SQL Server</a>?</p>
  
  <p>EDIT: here is some example code that attempts to write entities with 260 properties to Cosmos DB Table Storage and the error that is thrown. Account names and keys and such are redacted</p>
  
  <pre><code># Libraries
  from azure.cosmosdb.table.tableservice import TableService
  from azure.cosmosdb.table.models import Entity
  import csv
  import os
  
  
  # Connect
  ## Table Storage
  """
  access_key = 'access_key'
  table_service = TableService(account_name='account_name', account_key= access_key)
  """
  ## Cosmos DB Table Storage
  connection_string = "connection_string"
  table_service = TableService(connection_string=connection_string)
  
  # Create Table
  if not table_service.exists('testTable'):
      table_service.create_table('testTable')
  
  length = 260
  letters = [chr(i) for i in range(ord('a'), ord('z') + 1)]
  keys = [a + b + c for a in letters for b in letters for c in letters][:length] 
  values = ['0' * (8 - len(str(i))) + str(i) for i in range(length)]
  entity = dict(zip(keys, values))
  entity['PartitionKey'] = 'TestKey'
  entity['RowKey'] = '1'
  table_service.insert_entity('testTable', entity)
  </code></pre>
  
  <p>This raises "ValueError: The entity contains more properties than allowed."</p>