``rdbms-subsetter`` promises that each child row will have whatever parent rows arerequired by its foreign keys. It will also *try* to include most child rows belongingto each parent row (up to the supplied ``--children`` parameter, default 3 each), but itcan't make any promises. (Demanding all children can lead to infinite propagation inthoroughly interlinked databases, as every child record demands new parent records,which demand new child records, which demand new parent records...so increase ``--children`` with caution.)

When row numbers in your tables vary wildly (tens to billions, for example),consider using the ``-l`` flag, which sets row number targetsby a logarithmic formula.When ``-l`` is set, if ``f`` is the fraction specified,and the original table has ``n`` rows,then each new table's row target will be::

math.pow(10, math.log10(n)*f)

A fraction of ``0.5`` seems to produce good results, converting 10 rows to 3,1,000,000 to 1,000, and 1,000,000,000 to 31,622.

Rows are selected randomly, but for tables with a single primary key column, youcan force rdbms-subsetter to include specific rows (and their dependencies) with``force=<tablename>:<primary key="" value="">``. The children, grandchildren, etc. ofthese rowsare exempted from the ``--children`` limit.

``rdbms-subsetter`` only performs the INSERTS; it's your responsibility to setup the target database first, with its foreign key constraints. The easiestway to do this is with your RDBMS's dump utility. For example, for PostgreSQL,

Rows are taken from the schema visible by default to yourdatabase connection. You can also include rows from non-default schemaswith the ``--schema=<name>`` parameter (which can be used multiple times).Currently the target database must contain the corresponding tables in its ownschema of the same name (moving between schemas of different names is not yetsupported).

You can restrict the tables included in the sample via the ``--table``(``-t``) and ``--exclude-table`` (``-T``) parameters (which can be usedmultiple times). These parameters take a table name or pattern with wildcards(``*``), and supports both qualified names (i.e. ``schema.table``) and simplenames. When both ``-t`` and ``-T`` are given, the behavior is to include justthe tables that match at least one ``-t`` switch, but no ``-T`` switches.

When target db write buffering is enabled (which it is by default), subsetextraction for complex schemas that have tangled foreign key relationships mayfail. To disable write buffering, set the buffer parameter to 0::

If you need to honor relationships that aren't actually defined as foreign-keyconstraints in the database - for example, if you are using MySQL MyISAMand can't define constraints - you can specify aconfiguration file with ``--config``. The config file should specify constraintsin JSON. For example,

Optionally, you can qualify ``child_table_name``, i.e.``schema_name.child_table_name``. Cross-schema constraints are also supported.

``rdbms-subsetter`` treats these constraints like real foreign keys and fetchesparent and child rows as described above.

Signal handlers---------------If you provide a python module with appropriate signal handling functions, and specify that modulewhen calling the script like ``--import=my.signals.signal_handlers``, then any signal handlers that youhave registered in your module will be called when the corresponding signals are sent duringthe DB subsetting process.