Skip to content

Commit 86e97db

Browse files
committed
Merge pull request maxmind#31 from maxmind/dave/doc-updates
Add a section to the docs discouraging the use of names as unique keys
2 parents 3bf19a8 + eed3695 commit 86e97db

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,20 @@ be thrown. If the file is invalid or there is a bug in the reader, a
251251
problem. If an IP address is not in the database, a ``AddressNotFoundError``
252252
exception will be thrown.
253253

254+
Values to use for Database or Dictionary Keys
255+
---------------------------------------------
256+
257+
**We strongly discourage your from using a value from any `names` accessor as
258+
a key in a database or dicts.**
259+
260+
These names may change between releases. Instead we recommend using one of the
261+
following:
262+
263+
* ``geoip2.records.City`` - ``city.geoname_id``
264+
* ``geoip2.records.Continent`` - ``continent.code`` or ``continent.geoname_id``
265+
* ``geoip2.records.Country`` and ``geoip2.records.RepresentedCountry`` - ``country.iso_code`` or ``country.geoname_id``
266+
* ``geoip2.records.subdivision`` - ``subdivision.iso_code`` or ``subdivision.geoname_id``
267+
254268
What data is returned?
255269
----------------------
256270

0 commit comments

Comments
 (0)