Writes a seed corpus to the given database table
@param {function} dynamodbWriteFunction The DynamoDB DocumentClient.batchWrite or DynamoDB.batchWriteItem function
@param {string} tableName The table name
@param {any[]} seeds The seed values
18021
function writeSeeds(dynamodbWriteFunction, tableName, seeds) {
  if (!dynamodbWriteFunction) {
    throw new Error("dynamodbWriteFunction argument must be provided");
  }
  if (!tableName) {
    throw new Error("table name argument must be provided");
  }
  if (!seeds) {
    throw new Error("seeds argument must be provided");
  }

  if (seeds.length > 0) {
    const seedChunks = _.chunk(seeds, MAX_MIGRATION_CHUNK);
    return BbPromise.map(
      seedChunks,
      (chunk) => writeSeedBatch(dynamodbWriteFunction, tableName, chunk),
      { concurrency: MIGRATION_SEED_CONCURRENCY }
    )
      .then(() => console.log("Seed running complete for table: " + tableName));
  }
}
152163
@Override
    void getTableNamesForWrite(OrderedHashSet set) {

        /* A VoltDB Extension.
         * Base table could be null for views.
         */
        if (baseTable==null || baseTable.isTemp()) {
            return;
        }

        set.add(baseTable.getName());

        for (int i = 0; i < baseTable.fkPath.length; i++) {
            set.add(baseTable.fkPath[i].getMain().getName());
        }

        getTriggerTableNames(set, true);
    }
735228
private void createIndex(String tableName, String indexName, String... fieldNames)
    {
        StringBuilder builder = new StringBuilder();
        builder.append("CREATE INDEX IF NOT EXISTS ");
        builder.append(indexName);
        builder.append(" ON ");
        builder.append(tableName);
        builder.append(Constants.OPEN_ROUND_BRACKET);
        for (String fieldName : fieldNames)
        {
            builder.append(fieldName);
            builder.append(Constants.COMMA);
        }
        builder.deleteCharAt(builder.length() - 1);
        builder.append(Constants.CLOSE_ROUND_BRACKET);
        StatementResult result = tableAPI.executeSync(builder.toString());
        if (!result.isSuccessful())
        {
            throw new SchemaGenerationException("Unable to CREATE Index with Index Name [" + indexName
                    + "] for table [" + tableName + "]");
        }
    }
1028812
def _write_function(schema):
    
    def func(
        data,
        filename=None,
        schema=schema,
        id_col='uid',
        sequence_col='sequence',
        extra_data=None,
        alphabet=None,
        **kwargs):
        # Use generic write class to write data.
        return _write(
            data,
            filename=filename,
            schema=schema,
            id_col=id_col,
            sequence_col=sequence_col,
            extra_data=extra_data,
            alphabet=alphabet,
            **kwargs
        )
    # Update docs
    func.__doc__ = _write_doc_template(schema)
    return func
675955
function generateTableInsertSQLList( $tableName, $tableDef, $dataEntries, $params, $withClosure = true )
    {
        $sqlList = eZDBSchemaInterface::generateTableInsertSQLList( $tableName, $tableDef, $dataEntries, $params, $withClosure );

        foreach ( $tableDef['fields'] as $fieldName => $fieldDef )
        {
            if ( $fieldDef['type'] == 'auto_increment' )
            {
                $sql = "SELECT setval('" . $tableName . "_{$fieldName}_seq',max(" . $fieldName . ")+1) FROM " . $tableName;
                if ( $withClosure )
                    $sql .= ";";
                $sqlList[] = $sql;
            }
        }
        return $sqlList;
    }
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
313740
function writeJSON(dbName, schema) {

    var baseUrl = 'http://www.filltext.com/?',
        promises = [],
        collection;

    for (collection in schema) {

        var meta = schema[collection].meta,
            fields = meta.fields,
            url;

        url = Object.keys(fields).map(function(key) {
            if (fields[key][0] === '[' && fields[key].slice(-1) === ']') {
                return key + '=' + fields[key];
            }
            return key + '={' + fields[key] + '}';
        }).join('&') + '&rows=' + meta.rows;

        console.log('Url for', collection, url);

        (function(c) {
            promises.push(fetch(baseUrl + url).then(function(response) {
                return response.json();
            })
            .then(function(rows) {
                schema[c] = rows;
            }));
        })(collection);
    }

    return Promise.all(promises).then(function() {
        fs.writeFile(dbName, JSON.stringify(schema, null, 4), function(err) {
            if (err) {
                Promise.reject('Failed to save JSON file: ' + err);
            }
        });
    });
}
4539
protected void writeFunction( FunctionInputDef function)
    {
    xmlWriter_
      .element( FUNCTION_TAG)
      .attribute( NAME_ATR, function.getName())
      .content( () ->
        {
        writeAnnotations( function);
        for( String varType : function.getVarTypes())
          {
          writeInputs(
            varType,
            toStream( function.getVarDefs())
            .filter( varDef -> varDef.getType().equals( varType))
            .sorted());
          }
        })
      .write();
    }
1230869
@Override
  public void write(JdbcEntryData record) throws IOException {
    if (LOG.isDebugEnabled()) {
      LOG.debug("Writing " + record);
    }
    try {
      this.commands.insert(this.databaseName, this.tableName, record);
      this.recordWrittenCount++;
    } catch (Exception e) {
      this.failed = true;
      throw new RuntimeException(e);
    }
  }
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")
763513
private Set<Long> writeToNode(String path, long uuid, OutputStream out)
            throws KeeperException.NodeExistsException, IOException, UnknownTableException, DroppedTableException {
        ByteArrayOutputStream bufferOut = new ByteArrayOutputStream();
        byte[] tableContent;
        Set<Long> uuids;
        Exception exception = null;

        try {
            // Load the table content from the source
            uuids = _source.loadAndSerialize(uuid, bufferOut);
            tableContent = bufferOut.toByteArray();
        } catch (UnknownTableException | DroppedTableException e) {
            // Record the exception and store the JSON serialized exception as the table content
            exception = e;
            tableContent = JsonHelper.asJson(e).getBytes(Charsets.UTF_8);
            uuids = ImmutableSet.of();
        }

        int nodeContentLength = 4 + 8 * uuids.size() + tableContent.length;  // 4 byte uuid count + 8 bytes per uuid + tableContent
        bufferOut = new ByteArrayOutputStream(nodeContentLength);
        DataOutputStream nodeOut = new DataOutputStream(bufferOut);

        if (exception == null) {
            // Write the actual number of UUIDs associated with the table
            nodeOut.writeInt(uuids.size());
            for (long sourceUuid : uuids) {
                nodeOut.writeLong(sourceUuid);
            }
        } else {
            // Write the exception code (no UUIDs will be written so no size is required)
            nodeOut.writeInt(exception instanceof UnknownTableException ? UNKNOWN_TABLE : DROPPED_TABLE);
        }

        nodeOut.write(tableContent);

        byte[] nodeContent = bufferOut.toByteArray();

        try {
            // Write the content to ZooKeeper
            _curator.create().withMode(CreateMode.PERSISTENT).forPath(path, nodeContent);
            _log.debug("Wrote table for UUID {} to {}", uuid, path);
        } catch (Throwable t) {
            // If the node exists then there was a race condition with another server caching the same table.  Pass
            // to the caller so they can retry reading the value.
            Throwables.propagateIfInstanceOf(t, KeeperException.NodeExistsException.class);
            Throwables.propagateIfInstanceOf(t, IOException.class);
            throw Throwables.propagate(t);
        }

        if (exception != null) {
            // This will always raise the exception
            Throwables.propagateIfPossible(exception, UnknownTableException.class, DroppedTableException.class);
        }

        out.write(tableContent);
        return uuids;
    }
762361
private void cacheShardValue(TableDefinition tableDef,
                                 Integer         shardNumber,
                                 Date            shardStart) {
        // Get or create the app name -> table map
        String appName = tableDef.getAppDef().getAppName();
        Map<String, Map<Integer, Date>> tableShardNumberMap = m_appShardMap.get(appName);
        if (tableShardNumberMap == null) {
            tableShardNumberMap = new HashMap<String, Map<Integer,Date>>();
            m_appShardMap.put(appName, tableShardNumberMap);
        }
        
        // Get or create the table name -> shard number map
        String tableName = tableDef.getTableName();
        Map<Integer, Date> shardNumberMap = tableShardNumberMap.get(tableName);
        if (shardNumberMap == null) {
            shardNumberMap = new HashMap<Integer, Date>();
            tableShardNumberMap.put(tableName, shardNumberMap);
        }
        
        // Add the shard number -> start date
        shardNumberMap.put(shardNumber, shardStart);
        m_logger.debug("Sharding date for {}.{} shard #{} set to: {} ({})",
                       new Object[]{appName, tableName, shardNumber, shardStart.getTime(), Utils.formatDateUTC(shardStart)});
    }
630280
@Override
    public void writeColumns(Table htable, Object rowKey, Map<String, Object> columns, String columnFamilyName)
            throws IOException
    {
        if (columns != null && !columns.isEmpty())
        {
            Put p = new Put(HBaseUtils.getBytes(rowKey));
            for (String columnName : columns.keySet())
            {
                p.addColumn(columnFamilyName.getBytes(), Bytes.toBytes(columnName),
                        HBaseUtils.getBytes(columns.get(columnName)));
            }
            htable.put(p);
        }
    }
853180
protected function seedRowData(string $tableName, array $data, array $columnTypes = []): void
    {
        $attributeTypeGetter = $this->createAttributeTypeGetter($columnTypes);

        $this->insertRow($tableName, $this->getConnection(), $data, $attributeTypeGetter);
    }
801175
@Override
    public void writeColumn(HTableInterface htable, String columnFamily, Object rowKey, Attribute column,
            Object columnObj) throws IOException
    {
        Put p = new Put(HBaseUtils.getBytes(rowKey));
        p.add(Bytes.toBytes(columnFamily), Bytes.toBytes(((AbstractAttribute) column).getJPAColumnName()),
                Bytes.toBytes(columnObj.toString()));

        htable.put(p);
    }
959595
public boolean createFunctions(String tableName, String columnName) {

		boolean created = has(tableName, columnName);
		if (created) {
			createAllFunctions();
		}
		return created;
	}
953231
function (docId, name, value, changedByUserId, destroyedAt, recordedAt, updatedAt,
  seq, quorum, userUUID, colId, docUUID, forUserId, forUserUUID,
  recordedByUserId, colName, recordedByUUID) {
  this.docId = docId;
  this.name = name;
  this.value = value;
  this.changedByUserId = changedByUserId;
  this.destroyedAt = destroyedAt;
  this.recordedAt = recordedAt;
  this.updatedAt = updatedAt;
  this.seq = seq;
  this.quorum = quorum;
  this.userUUID = userUUID;
  this.colId = colId;
  this.docUUID = docUUID;
  this.forUserId = forUserId;
  this.forUserUUID = forUserUUID;
  this.recordedByUserId = recordedByUserId;
  this.colName = colName;
  this.recordedByUUID = recordedByUUID;
}