Sql

Creates documents from the results of a SQL query. Each row is output as a new document and every column is used as the metadata (or content) of the new document. Input documents are ignored.

Usage

  • Sql(string connectionString, string sql)

    Creates documents from a SQL query given the specified connection string and query.

    • connectionString

      The connection string.

    • sql

      The SQL query.

Fluent Methods

Chain these methods together after the constructor to modify behavior.

  • AddKeyConversion(string originalKeyName, string newKeyName)

    Allows renaming of keys during document creation: "If you find key X, create it as key Y instead."

    • originalKeyName

      The name of the original key to convert.

    • newKeyName

      The name you want to convert the key to.

  • ExcludeKeys(params string[] keys)

    Allows creation of a list of keys to discard.

    • keys

      The keys to discard.

  • IncludeKeys(params string[] keys)

    Allows creation of a list of keys to keep. If this list any members, any keys other than those in this list will be discarded.

    • keys

      The keys to keep.

  • WithContentKey(string contentKey)

    Specifies which metakey should be used for the document content

    • contentKey

      The name of the content property.

  • WithLimit(int limit)

    Limits the number of created documents.

    • limit

      The number of objects to create documents from.

GitHub