\hypertarget{doc_help_kdb-import_md_autotoc_md1713}{}\doxysection{S\+Y\+N\+O\+P\+S\+IS}\label{doc_help_kdb-import_md_autotoc_md1713}
{\ttfamily kdb import $<$destination$>$ \mbox{[}$<$format$>$\mbox{]}}
Where {\ttfamily destination} is the destination where the user wants the keys to be imported into. {\ttfamily format} is the format of the keys that are imported.\hypertarget{doc_help_kdb-import_md_autotoc_md1714}{}\doxysection{D\+E\+S\+C\+R\+I\+P\+T\+I\+ON}\label{doc_help_kdb-import_md_autotoc_md1714}
If the {\ttfamily format} argument is not passed, then the default format will be used as determined by the value of the {\ttfamily sw/kdb/current/format} key. By default, that key is set to the {\ttfamily storage} format. The {\ttfamily format} attribute relies on Elektra’s plugin system to properly import the configuration. The user can view all plugins available for use by running the kdb-\/plugin-\/list(1) command. To learn about any plugin, the user can simply use the kdb-\/plugin-\/info(1) command.
This command allows a user to import an existing configuration into the key database. The configuration that the user wants to import is read from {\ttfamily stdin}. The user should specify the format that the current configuration or keys are in, otherwise the default format will be used. The default format is {\ttfamily storage} but can be changed by editing the value of the {\ttfamily /sw/elektra/kdb/\#0/current/format} key. The {\ttfamily storage} plugin can be configured at compile-\/time or changed by the link {\ttfamily libelektra-\/storage.\+so}.\hypertarget{doc_help_kdb-import_md_autotoc_md1715}{}\doxysection{C\+O\+N\+F\+L\+I\+C\+TS}\label{doc_help_kdb-import_md_autotoc_md1715}
Conflicts can occur when importing a configuration to a part of the database where keys already exist. Conflicts when importing can be resolved using a strategy with the {\ttfamily -\/s} argument.
Specific to {\ttfamily kdb import} the following strategy exists\+:
\begin{DoxyItemize}
\item {\ttfamily validate}\+: apply metadata as received from base, and then cut+append all keys as imported. If the appended keys do not have a namespace, the namespace given by {\ttfamily -\/N} is added.
\end{DoxyItemize}
The other strategies are implemented by the merge framework and are documented in \mbox{\hyperlink{doc_help_elektra-merge-strategy_md}{elektra-\/merge-\/strategy(7)}}.\hypertarget{doc_help_kdb-import_md_autotoc_md1716}{}\doxysection{O\+P\+T\+I\+O\+NS}\label{doc_help_kdb-import_md_autotoc_md1716}
\begin{DoxyItemize}
\item {\ttfamily -\/H}, {\ttfamily -\/-\/help}\+: Show the man page.
\item {\ttfamily -\/V}, {\ttfamily -\/-\/version}\+: Print version info.
\item {\ttfamily -\/p}, {\ttfamily -\/-\/profile $<$profile$>$}\+: Use a different kdb profile.
\item {\ttfamily -\/C}, {\ttfamily -\/-\/color $<$when$>$}\+: Print never/auto(default)/always colored output.
\item {\ttfamily -\/s}, {\ttfamily -\/-\/strategy $<$name$>$}\+: Specify which strategy should be used to resolve conflicts.
\item {\ttfamily -\/v}, {\ttfamily -\/-\/verbose}\+: Explain what is happening. Prints additional information in case of errors/warnings.
\item {\ttfamily -\/d}, {\ttfamily -\/-\/debug}\+: Give debug information. Prints additional debug information in case of errors/warnings.
\item {\ttfamily -\/c}, {\ttfamily -\/-\/plugins-\/config}\+: Add a configuration to the format plugin.
\item {\ttfamily -\/N}, {\ttfamily -\/-\/namespace $<$namespace$>$}\+: Specify the namespace to use when writing cascading keys ({\ttfamily validate} strategy only). See \href{\#KDB}{\texttt{ below in K\+DB}}.
\end{DoxyItemize}\hypertarget{doc_help_kdb-import_md_autotoc_md1717}{}\doxysection{K\+DB}\label{doc_help_kdb-import_md_autotoc_md1717}
\begin{DoxyItemize}
\item {\ttfamily /sw/elektra/kdb/\#0/current/verbose}\+: Same as {\ttfamily -\/v}\+: Explain what is happening (output merged keys).
\item {\ttfamily /sw/elektra/kdb/\#0/current/format} Change default format (if none is given at commandline) and built-\/in default is not your preferred format.
\item {\ttfamily /sw/elektra/kdb/\#0/current/namespace}\+: Specifies which default namespace should be used when setting a cascading name. By default the namespace is user, except {\ttfamily kdb} is used as root, then {\ttfamily system} is the default ({\ttfamily validate} strategy only).
\end{DoxyItemize}\hypertarget{doc_help_kdb-import_md_autotoc_md1718}{}\doxysection{E\+X\+A\+M\+P\+L\+ES}\label{doc_help_kdb-import_md_autotoc_md1718}
To import a configuration stored in the X\+ML format in a file called {\ttfamily example.\+xml} below {\ttfamily user/keyset}\+:~\newline
{\ttfamily kdb import user/keyset xmltool $<$ example.\+xml}
To import a configuration stored in the {\ttfamily ini} format in a file called {\ttfamily example.\+ini} below {\ttfamily user/keyset} replacing any previous keys stored there\+:~\newline
{\ttfamily cat example.\+ini $\vert$ kdb import -\/s cut user/keyset ini}
To import a configuration stored in the {\ttfamily ini} format in a file called {\ttfamily example.\+ini} below {\ttfamily user/keyset} keeping any previous keys stored there that aren\textquotesingle{}t present in the newly imported configuration\+:~\newline
{\ttfamily cat example.\+ini $\vert$ kdb import -\/s import user/keyset ini}
To restore a backup (stored as {\ttfamily sw.\+ecf}) of a user\textquotesingle{}s configuration below {\ttfamily system/sw}\+:~\newline
{\ttfamily cat sw.\+ecf $\vert$ kdb import system/sw}
To import a sample {\ttfamily xml} content with the {\ttfamily xerces} plugin\+:
\begin{DoxyCode}{0}
\DoxyCodeLine{\# import two keys from a xml string}
\DoxyCodeLine{kdb import user/tests/kdb-\/import/ xerces <<< "onetwo"}
\DoxyCodeLine{}
\DoxyCodeLine{\# get the values and verify they got imported correctly}
\DoxyCodeLine{kdb get user/tests/kdb-\/import/one}
\DoxyCodeLine{\#> one}
\DoxyCodeLine{kdb get user/tests/kdb-\/import/two}
\DoxyCodeLine{\#> two}
\DoxyCodeLine{kdb rm -\/r user/tests/kdb-\/import}
\end{DoxyCode}
To import a sample {\ttfamily xml} content via specifying the file format directly\+:
\begin{DoxyCode}{0}
\DoxyCodeLine{\# import two keys from a xml string}
\DoxyCodeLine{kdb import user/tests/kdb-\/import/ xml <<< "onetwo"}
\DoxyCodeLine{}
\DoxyCodeLine{\# get the values and verify they got imported correctly}
\DoxyCodeLine{kdb get user/tests/kdb-\/import/one}
\DoxyCodeLine{\#> one}
\DoxyCodeLine{kdb get user/tests/kdb-\/import/two}
\DoxyCodeLine{\#> two}
\DoxyCodeLine{}
\DoxyCodeLine{kdb rm -\/r user/tests/kdb-\/import}
\end{DoxyCode}
\hypertarget{doc_help_kdb-import_md_autotoc_md1719}{}\doxysection{S\+E\+E A\+L\+SO}\label{doc_help_kdb-import_md_autotoc_md1719}
\begin{DoxyItemize}
\item \mbox{\hyperlink{doc_help_elektra-merge-strategy_md}{elektra-\/merge-\/strategy(7)}}
\end{DoxyItemize}