This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | |||
|
admin:basics:rawdata:constraints [2011/03/03 04:38] els |
— (current) | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ~~NOTOC~~ | ||
| - | {{page>:top_add&nofooter&noeditbtn}} | ||
| - | |||
| - | ====== Administration: Omnidex Fundamentals ====== | ||
| - | |||
| - | ===== Raw Data Files ===== | ||
| - | |||
| - | [[admin:basics:rawdata:home|Overview]] | | ||
| - | [[admin:basics:rawdata:layout|Record Layouts]] | | ||
| - | **[[admin:basics:rawdata:constraints|Table Constraints]]** | | ||
| - | [[admin:basics:rawdata:types|File Types]] | ||
| - | |||
| - | ---- | ||
| - | ==== Table Constraints ==== | ||
| - | |||
| - | An Omnidex Environment against raw data files can include primary and foreign key constraints, just like an environment against a relational database. When these constraints are declared, Omnidex will honor the declared constraints, though it will not verify or enforce them. | ||
| - | |||
| - | When a raw data file has one or more columns that uniquely identify each row, they can be declared as a primary key. Omnidex will rely on primary key definitions, so do not declare a primary key unless it is truly unique. | ||
| - | |||
| - | Raw data files can also include foreign key constraints. Omnidex will also rely on foreign key definitions; however, it is also tolerant of minor errors in foreign key integrity. Raw data files often come from multiple suppliers, and the data may not exactly match. It is fine to declare a foreign key constraint in these situations as long as the differences are relatively minor. Note that errors in foreign key integrity may affect performance. | ||
| - | |||
| - | Omnidex requires that the datatypes of foreign keys match those of the corresponding primary key. | ||
| - | |||
| - | <code sql> | ||
| - | create table "COUNTRIES" | ||
| - | physical "dat/countries.dat" | ||
| - | ( | ||
| - | "COUNTRY" CHARACTER(2), | ||
| - | "DESCRIPTION" STRING(47), | ||
| - | "LATITUDE" FLOAT usage "LATITUDE", | ||
| - | "LONGITUDE" FLOAT usage "LONGITUDE", | ||
| - | "CAPITAL" STRING(31), | ||
| - | "CAPITAL_LAT" FLOAT usage "LATITUDE", | ||
| - | "CAPITAL_LONG" FLOAT usage "LONGITUDE", | ||
| - | constraint COUNTRIES_COUNTRY_PK primary ("COUNTRY") | ||
| - | ) | ||
| - | in "simple.xml"; | ||
| - | |||
| - | |||
| - | create table "STATES" | ||
| - | physical "dat/states.dat" | ||
| - | ( | ||
| - | "STATE" CHARACTER(2), | ||
| - | "DESCRIPTION" STRING(31), | ||
| - | "STATE_CODE" CHARACTER(2), | ||
| - | "REGION" CHARACTER(2), | ||
| - | "COUNTRY" CHARACTER(2), | ||
| - | "TAX_RATE" FLOAT, | ||
| - | constraint STATES_STATE_PK primary ("STATE"), | ||
| - | constraint STATES_COUNTRY_FK foreign ("COUNTRY") references "COUNTRIES" | ||
| - | ) | ||
| - | in "simple.xml"; | ||
| - | |||
| - | </code> | ||
| - | |||
| - | ===== ===== | ||
| - | |||
| - | **[[admin:basics:rawdata:layout|Prev]]** | | ||
| - | **[[admin:basics:rawdata:types|Next]]** | ||
| - | |||
| - | ====== Additional Resources ====== | ||
| - | |||
| - | See also: | ||
| - | |||
| - | {{page>:admin:basics:see_also&nofooter&noeditbtn}} | ||
| - | |||
| - | {{page>:bottom_add&nofooter&noeditbtn}} | ||