Returns the number of provisioned read units for the table

    :type table_name: str
    :param table_name: Name of the DynamoDB table
    :returns: int -- Number of read units
558367
def get_provisioned_table_read_units(table_name):
    
    try:
        desc = DYNAMODB_CONNECTION.describe_table(table_name)
    except JSONResponseError:
        raise

    read_units = int(
        desc[u'Table'][u'ProvisionedThroughput'][u'ReadCapacityUnits'])

    logger.debug('{0} - Currently provisioned read units: {1:d}'.format(
        table_name, read_units))
    return read_units
377699
def table_gsis(table_name):
    
    try:
        desc = DYNAMODB_CONNECTION.describe_table(table_name)[u'Table']
    except JSONResponseError:
        raise

    if u'GlobalSecondaryIndexes' in desc:
        return desc[u'GlobalSecondaryIndexes']

    return []
72464
def get_table(self, name):
        
        if name is None:
            assert self.active_table, "Can't get table without name unless an active table is set"
            name = self.active_table.name

            if self.active_worksheet:
                table = self.active_worksheet.get_table(name)
                assert table is self.active_table, "Active table is not from the active sheet"
                return table, self.active_worksheet

            for ws in self.worksheets:
                try:
                    table = ws.get_table(name)
                    if table is self.active_table:
                        return table, ws
                except KeyError:
                    pass

            raise RuntimeError("Active table not found in any sheet")

        # if the tablename explicitly uses the sheetname find the right sheet
        if "!" in name:
            ws_name, table_name = map(lambda x: x.strip("'"), name.split("!", 1))
            for ws in self.worksheets:
                if ws.name == ws_name:
                    table = ws.get_table(table_name)
                    return table, ws
            raise KeyError(name)

        # otherwise look in the current table
        if self.active_worksheet:
            table = self.active_worksheet.get_table(name)
            return table, self.active_worksheet

        # or fallback to the first matching name in any table
        for ws in self.worksheets:
            try:
                table = ws.get_table(name)
                return table, ws
            except KeyError:
                pass

        raise KeyError(name)
347044
def tablename(self) -> str:
        
        if self._tablename:
            return self._tablename
        return self.table.name
534649
def get_provisioned_table_write_units(table_name):
    
    try:
        desc = DYNAMODB_CONNECTION.describe_table(table_name)
    except JSONResponseError:
        raise

    write_units = int(
        desc[u'Table'][u'ProvisionedThroughput'][u'WriteCapacityUnits'])

    logger.debug('{0} - Currently provisioned write units: {1:d}'.format(
        table_name, write_units))
    return write_units
1360533
def get_table(self, name):
        
        response = self.layer1.describe_table(name)
        return Table(self,  response)
378728
def table(self, name: str):
        
        if self._check_db() == False:
            return
        try:
            res = self.getall(name)
        except Exception as e:
            self.err(e, self.table, "Can not get records from database")
            return
        if res is None:
            self.warning("Table", name, "does not contain any record")
            return
        num = len(res)
        self.info(num, "rows")
        self.info("Fields:", ", ".join(list(res)))
343786
def get_table_keys_name(self, table_name, keys):
        
        table = self.tables.get(table_name)
        if not table:
            return None, None
        else:
            if len(keys) == 1:
                for key in keys:
                    if key in table.hash_key_names:
                        return key, None
            # for potential_hash, potential_range in zip(table.hash_key_names, table.range_key_names):
            #     if set([potential_hash, potential_range]) == set(keys):
            #         return potential_hash, potential_range
            potential_hash, potential_range = None, None
            for key in set(keys):
                if key in table.hash_key_names:
                    potential_hash = key
                elif key in table.range_key_names:
                    potential_range = key
            return potential_hash, potential_range
874154
def _parse_throttle(self, tablename, throttle):
        
        amount = []
        desc = self.describe(tablename)
        throughputs = [desc.read_throughput, desc.write_throughput]
        for value, throughput in zip(throttle[1:], throughputs):
            if value == "*":
                amount.append(0)
            elif value[-1] == "%":
                amount.append(throughput * float(value[:-1]) / 100.0)
            else:
                amount.append(float(value))
        cap = Capacity(*amount)  # pylint: disable=E1120
        return RateLimit(total=cap, callback=self._on_throttle)
1105106
def get_table(table_name):
    
    table = get_raw_table(table_name)
    if isinstance(table, TableFuncWrapper):
        table = table()
    return table
95647
def _get_download_table_ids(self):
        
        all_table_names = []  # matching per-date table names
        logger.info('Querying for all tables in dataset')
        tables = self.service.tables()
        request = tables.list(projectId=self._PROJECT_ID,
                              datasetId=self._DATASET_ID)
        while request is not None:
            response = request.execute()
            # if the number of results is evenly divisible by the page size,
            # we may end up with a last response that has no 'tables' key,
            # and is empty.
            if 'tables' not in response:
                response['tables'] = []
            for table in response['tables']:
                if table['type'] != 'TABLE':
                    logger.debug('Skipping %s (type=%s)',
                                 table['tableReference']['tableId'],
                                 table['type'])
                    continue
                if not self._table_re.match(table['tableReference']['tableId']):
                    logger.debug('Skipping table with non-matching name: %s',
                                 table['tableReference']['tableId'])
                    continue
                all_table_names.append(table['tableReference']['tableId'])
            request = tables.list_next(previous_request=request,
                                       previous_response=response)
        return sorted(all_table_names)
94095
def _len_table_cache(self):
        """"""

        length = 0

        for table in self._table_cache:
            length += len(self._table_cache[table])

        return length
351318
def get_provisioned_gsi_write_units(table_name, gsi_name):
    
    try:
        desc = DYNAMODB_CONNECTION.describe_table(table_name)
    except JSONResponseError:
        raise

    for gsi in desc[u'Table'][u'GlobalSecondaryIndexes']:
        if gsi[u'IndexName'] == gsi_name:
            write_units = int(
                gsi[u'ProvisionedThroughput'][u'WriteCapacityUnits'])
            break

    logger.debug(
        '{0} - GSI: {1} - Currently provisioned write units: {2:d}'.format(
            table_name, gsi_name, write_units))
    return write_units
1322589
def get_table(self, id_or_name):
        
        url = self.build_url(self._endpoints.get('get_table').format(id=id_or_name))
        response = self.session.get(url)
        if not response:
            return None
        return self.table_constructor(parent=self, **{self._cloud_data_key: response.json()})
1332965
def _valid_table_name(self, table):
        
        if table is None or not len(table.strip()):
            raise ValueError("Invalid table name: %r" % table)
        return table.strip()
350565
def createDdbTable(region=None, table="credential-store", **kwargs):
    '''
    
    '''
    session = get_session(**kwargs)
    dynamodb = session.resource("dynamodb", region_name=region)
    if table in (t.name for t in dynamodb.tables.all()):
        print("Credential Store table already exists")
        return

    print("Creating table...")
    dynamodb.create_table(
        TableName=table,
        KeySchema=[
            {
                "AttributeName": "name",
                "KeyType": "HASH",
            },
            {
                "AttributeName": "version",
                "KeyType": "RANGE",
            }
        ],
        AttributeDefinitions=[
            {
                "AttributeName": "name",
                "AttributeType": "S",
            },
            {
                "AttributeName": "version",
                "AttributeType": "S",
            },
        ],
        ProvisionedThroughput={
            "ReadCapacityUnits": 1,
            "WriteCapacityUnits": 1,
        }
    )

    print("Waiting for table to be created...")
    client = session.client("dynamodb", region_name=region)

    response = client.describe_table(TableName=table)

    client.get_waiter("table_exists").wait(TableName=table)

    print("Adding tag...")

    client.tag_resource(
        ResourceArn=response["Table"]["TableArn"],
        Tags=[
            {
                'Key': "Name",
                'Value': "credstash"
            },
        ]
    )

    print("Table has been created. "
          "Go read the README about how to create your KMS key")
176343
def table_stats(self, name, database=None):
        
        stmt = self._table_command('SHOW TABLE STATS', name, database=database)
        return self._exec_statement(stmt)