Recommended architecture
Treat a CSC download or export as an upstream reference snapshot, not as the place where your application stores custom data. A typical MySQL deployment uses either two databases on the same server or two clearly separated sets of tables:- A CSC refresh cannot delete your custom records.
- You can compare or roll back CSC releases independently of application data.
- The boundary between the ODbL reference database and proprietary application data remains easier to understand and document.
Adding a missing place
Do not insert a custom city intocsc_cities or allocate an ID from the CSC ID space. Store it in an application-owned table with your own primary key. If useful, link it to a CSC country or state through a mapping column or table.
For example, an application record can have:
- A CSC-backed place uses
csc_entity_typeandcsc_entity_id. - A missing or application-specific place leaves those fields empty and can use
csc_parent_typeandcsc_parent_idto identify its CSC parent. - Groups and parent/child relationships should reference
app_places.id, so their IDs remain under your control.
Preserve identifiers without depending on them blindly
Keep CSC’s originalid values unchanged inside the reference layer. They are required for relationships such as states.country_id and cities.state_id.
Do not assume that a numeric ID can never change in a future release. Before switching releases, validate important mappings using additional identifiers where available:
- Countries:
iso2oriso3 - States:
iso3166_2, country code, and state code - Cities:
wikiDataId, parent IDs, and country/state codes
Download and Export Tool options
Complete database downloads
The GitHub releases page publishes versioned, complete replacement assets in multiple formats. For MySQL, use thesql-world.sql.gz release asset.
Import a release into a new or staging database rather than over tables containing custom data:
Custom Export Tool downloads
The Export Tool can produce a smaller snapshot for selected countries, datasets, fields, and formats. Choose the SQL format for a MySQL-ready export. An Export Tool file can be imported into your own MySQL database and maintained independently. It is a point-in-time export: it does not remain connected to CSC and does not automatically update your server. When exporting related datasets, include their relationship fields:- Countries:
id,iso2, andiso3 - States:
id,country_id,country_code,iso2, andiso3166_2 - Cities:
id,country_id,state_id,country_code, andstate_code
Applying future updates
Self-hosted downloads currently use a snapshot workflow:GET /v1/changes for customers who need an incremental change feed. That API feature is separate from self-hosted download and Export Tool files.
Safe refresh workflow
Record the current version
Back up the current databases
Import into staging
csc_next. Do not overwrite the live CSC tables in place.Validate and compare
Reconcile affected mappings
Switch and retain a rollback copy
Field availability
API pricing controls which fields an API plan returns. It does not make the underlying ODbL fields exclusive to the API. The complete database downloads include the source schema. The Export Tool exposes selectable fields for countries, states, and cities, including the fields commonly requested for multi-level administrative data:typelevelparent_idiso3166_2on statesfips_codeon stateslatitudeandlongitudetimezonenativepopulationtranslationswikiDataId
ODbL considerations
Which terms apply
The standard delivery routes do not change the licence on the underlying CSC data:Private and internal use
ODbL permits commercial use. Section 4.5(c) also states that internal use of a derivative database is not public use, so you can privately modify and extend a self-hosted copy without publishing those internal changes.Public applications
If an application publicly displays or otherwise uses a Produced Work based on a substantial part of CSC data, ODbL section 4.3 requires a notice that makes users aware of the source and licence. Use the CSC attribution:Proprietary data and derivative databases
ODbL distinguishes a Derivative Database from a Collective Database:- Public use of a derivative CSC database triggers the share-alike and machine-readable access requirements in sections 4.4 and 4.6. This can also apply when a public Produced Work is generated from that derivative database.
- A collection of independent databases does not require the entire collection to use ODbL under section 4.5(a), although the CSC component remains under ODbL.
- Creating a Produced Work from an unmodified CSC database does not by itself create a derivative database under section 4.5(b), but public attribution can still be required.
What share-alike requires
If you publicly use a derivative CSC database or a Produced Work from it, section 4.6 requires you to offer recipients one of the following in machine-readable form:- the entire derivative database; or
- all alterations, or the method used to make them, including additional contents needed to recreate every difference from the CSC database.
Content sources and provenance
CSC is a community-maintained database. Contributions may use official government data, ISO material, Wikidata, Wikipedia, GeoNames, OpenStreetMap, and other documented sources. The repository’s Database Contents License grants the rights CSC can grant in the individual contents and requires compliance with ODbL. ODbL governs database rights, but section 2.4 notes that independent rights in individual contents can exist. CSC does not currently publish a complete row-by-row or field-by-field provenance and third-party licence register for every country, state, and city field. Source information for newer contributions is generally available in the pull request history, but is not embedded in every exported row. For legal, tax, regulatory, emergency, navigation, or official-boundary uses, obtain the controlling identifiers from the responsible authority, retain their source and version, and validate your mappings independently. The standard downloads, Export Tool, and API do not include a contractual field-by-field provenance warranty.Quick answers
Can I host CSC data on my own MySQL server?
Can I host CSC data on my own MySQL server?
Can I add missing cities and private relationships?
Can I add missing cities and private relationships?
Will CSC update my private database automatically?
Will CSC update my private database automatically?
Are incremental files available for self-hosted downloads?
Are incremental files available for self-hosted downloads?
Are extended fields exclusive to paid API plans?
Are extended fields exclusive to paid API plans?
Can my proprietary tourism data remain private?
Can my proprietary tourism data remain private?
Does a paid Export Tool or API plan remove ODbL?
Does a paid Export Tool or API plan remove ODbL?