Schema Discovery and Indexe
Schema Detection and Indexes
The driver provides different modes for determining schemas and indexes. Below are some example configurations.
TableSupport=None
Disables all queries that find tables and discover columns. The only tables reported will be the ones defined in schema files. TypeDetectionScheme is ignored. The driver will only use the schema files found in the Location directory. Using this option without schema files will result in no tables being available.
TableSupport=Basic
SELECT `bucket`, `scope`, name FROM system:keyspaces
The driver will discover the available buckets, but will not look inside of them for child tables. This is recommended for cases where you either want to reduce the time that schema detection takes, or if your buckets do not have primary indexes.
TableSupport=Full
SELECT `travel-sample`.* FROM `travel-sample` LIMIT 100
The driver will discover the available buckets, and look inside of each of those buckets for child tables. This provides the most flexible way to access nested data, but requires that each bucket on your server have primary indexes.
TypeDetectionScheme=None
The driver does not do any flavor detection or column type detection. Columns are always reported as VARCHAR. Child tables are still scanned depending on TableSupport setting.
TypeDetectionScheme=RowScan
The driver reads a sample of documnets from a bucket and determines the data type. It does not do any flavor detection.
TypeDetectionScheme=Infer
This uses the NQ1QL INFER statement to determine what tables and columns exist. This does more felxible flavor detection than DocType, but is only available for Couchbase Enterprise.
TypeDetectionScheme=DocType
SELECT META(`travel-sample`).id AS `Document.Id`, `travel-sample`.* FROM `travel-sample`
This discovers tables by checking at each bucket and looking for different values of the "docType" field in the documents. For Example, if the bucket beer-sample contains documents with "docType" = 'brewery' and "docType" = 'beer', this will generage three tables:bee-sample, beer-sample.brewery, and beer-sample.beer. Like RowScan, this will scan a sample of the documents in each flavor and determine the data type for each field.