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.
- Namespace
- Statiq
.Core - Interfaces
- Base Types
-
- object
- Module
- SyncModule
- ReadDataModule
<ReadSql, DataRow>
graph BT
Type-->Base0["ReadDataModule<ReadSql, DataRow>"]
Base0-->Base1["SyncModule"]
click Base1 "/api/Statiq.Common/SyncModule"
Base1-->Base2["Module"]
click Base2 "/api/Statiq.Common/Module"
Base2-->Base3["object"]
Type-.->Interface0["IModule"]
click Interface0 "/api/Statiq.Common/IModule"
Type["ReadSql"]
class Type type-node
Syntax
public class ReadSql : ReadDataModule<ReadSql, DataRow>, IModule
Constructors
Name | Summary |
---|---|
ReadSql |
Creates documents from a SQL query given the specified connection string and query. |
Methods
Name | Return Value | Summary |
---|---|---|
AfterExecution |
void |
Called after each module execution.
Inherited from Module
|
AfterExecutionAsync |
Task |
Called after each module execution.
Inherited from Module
|
BeforeExecution |
void |
Called before each module execution.
Inherited from Module
|
BeforeExecutionAsync |
Task |
Called before each module execution.
Inherited from Module
|
ExecuteAsync |
Task |
This should not be called directly, instead call
IExecutionContext.Execute() if you need to execute a module from within another module.
Inherited from Module
|
ExecuteContextAsync |
Task |
Executes the module once for all input documents.
Inherited from SyncModule
|
ExecuteInputAsync |
Task |
Executes the module.
Inherited from SyncModule
|
Finally |
void |
Called after each module execution, even if an exception is thrown during execution.
Inherited from Module
|
FinallyAsync |
Task |
Called after each module execution, even if an exception is thrown during execution.
Inherited from Module
|
GetDictionary |
IDictionary |
Used to convert each object from
GetItems(IExecutionContext) into a IDictionary<string, object>.
The base implementation checks if the object implements IDictionary<string, object> and just
performs a cast is if it does. If not, reflection is used to construct a IDictionary<string, object>
from all of the object's properties. Override this method to provide an alternate way of getting
key-value pairs for each object.
|
GetItems |
IEnumerable |
Gets the items to convert to documents. The
GetDictionary(TItem) method
is used to convert each item into a series of key-value pairs that is then used for
document creation.
|