<commit_before>=====================
Text Configuration
=====================

Newt DB provides a Python API for creating database connections.  You
can also use `ZODB's text configuration API
<http://www.zodb.org/en/latest/reference/zodb.html#module-ZODB.config>`_.
Text configuration usually provides the easiest way to configure a
database, especially if you need to provide non-default options.
Configuration strings can be included in configuration files by
themselves or as parts of larger configurations.

Here's an example text configuration for Newt DB::

  %import newt.db

  <newtdb foo>
    <zodb>
      <relstorage>
        keep-history false
        <newt>
          <postgresql>
            dsn dbname=''
          </postgresql>
        <newt>
      </relstorage>
    </zodb>
  </newtdb>

The syntax used is based on the syntax used by web servers such as
Apache and NGINX.  Elements, in angle brackets identify configuration
objects with name-value pairs inside elements to specify options.
Optional indentation indicates containment relationships and element
start and end tags must appear on their own lines.

Newt DB provides 2 configuration elements, ``newtdb`` and ``newt``.
These elements augment existing elements to provide extra behavior.

newt
   Wraps a RelStorage ``postgresql`` element to provide a Newt
   Postgres database adapter that stores JSON data in addition to
   normal database data.

newtdb
   Wraps a ``zodb`` element to provide a Newt database rather than a
   normal ZODB database.  The Newt database provides extra APIs for
   searching and transaction management.

Some things to note:

- An ``%import`` directives is used to load configuration schema for
  Newt DB.

- A ``keep-history`` option is used to request a history-free
  storage. History-free storages only keep current data and discard
  transaction meta data. History-preserving storages keep past data
  records until they are packed away and allow "time-travel" to view
  data in the past.  History preserving storages are much slower and
  require more maintenance.  Newt DB works with either
  history-preserving or history-free storages, but history-free
  storages are recommended and are the default for the Python API.<commit_msg>oops, nginx uses a different syntax<commit_after>=====================
Text Configuration
=====================

Newt DB provides a Python API for creating database connections.  You
can also use `ZODB's text configuration API
<http://www.zodb.org/en/latest/reference/zodb.html#module-ZODB.config>`_.
Text configuration usually provides the easiest way to configure a
database, especially if you need to provide non-default options.
Configuration strings can be included in configuration files by
themselves or as parts of larger configurations.

Here's an example text configuration for Newt DB::

  %import newt.db

  <newtdb foo>
    <zodb>
      <relstorage>
        keep-history false
        <newt>
          <postgresql>
            dsn dbname=''
          </postgresql>
        <newt>
      </relstorage>
    </zodb>
  </newtdb>

The syntax used is based on the syntax used by web servers such as
Apache.  Elements, in angle brackets identify configuration
objects with name-value pairs inside elements to specify options.
Optional indentation indicates containment relationships and element
start and end tags must appear on their own lines.

Newt DB provides 2 configuration elements, ``newtdb`` and ``newt``.
These elements augment existing elements to provide extra behavior.

newt
   Wraps a RelStorage ``postgresql`` element to provide a Newt
   Postgres database adapter that stores JSON data in addition to
   normal database data.

newtdb
   Wraps a ``zodb`` element to provide a Newt database rather than a
   normal ZODB database.  The Newt database provides extra APIs for
   searching and transaction management.

Some things to note:

- An ``%import`` directives is used to load configuration schema for
  Newt DB.

- A ``keep-history`` option is used to request a history-free
  storage. History-free storages only keep current data and discard
  transaction meta data. History-preserving storages keep past data
  records until they are packed away and allow "time-travel" to view
  data in the past.  History preserving storages are much slower and
  require more maintenance.  Newt DB works with either
  history-preserving or history-free storages, but history-free
  storages are recommended and are the default for the Python API.
{'fraction_non_alphanumeric': 0.07035064358632934, 'fraction_numerical': 0.0004438526409232135, 'mean_word_length': 3.784501061571125, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7128928', 'n_tokens_mistral': 1185, 'n_tokens_neox': 1131, 'n_words': 578}