The readarray package does honor comments already.
The issue here is not that a comment exists, but that the first record of the file is totally blank (by way of a comment). The package uses the first record to analyze how many fields are found per record (which is useful information for digesting a future array). This is where it gets hung up. If you eliminate the comment on the first record of the file, things work as expected.
However, I should probably have the package anticipate such a case. So I will give you two options: honor blank records, but don't get hung up if initial record is blank, OR ignore blank records.
I am editing my initial answer to provide both those options in one MWE. Here, I introduce a new \ifignoreblankreadarrayrecords, which can be made true or false. The MWE shows both options being used. The redefined \@readdef macro uses comments to highlight where changes were made to the original macro definition.
%dbA
\begin{filecontents*}[overwrite]{databaseA.csv}
% comment
distance = 60 % in cm
markerSide = 4 % in deg
\end{filecontents*}
\documentclass{article}
\usepackage{readarray}[2021-08-08]
\makeatletter
\newif\ifignoreblankreadarrayrecords
\def@readdef#1#2#3{%
\clear@array{#3}%
\edef\former@recordcount{\csname #3CELLS\endcsname}%
\def\first@row{T}%
\def\first@plane{T}%
\catcode\endlinechar=\readarrayendlinechar\relax %
\def#2{}%
\setcounter{@record}{0}%
\openin\rdar@file=#1%
\ifignoreblankreadarrayrecords\def\rdar@iftest{\rdar@fileline\empty}\else
\def\rdar@iftest{01}\fi
\loop\unless\ifeof\rdar@file%
\read\rdar@file to\rdar@fileline % Reads file line into \rdar@fileline%
\expandafter\ifx\rdar@iftest\else% PERFORM \ifignoreblankreadarrayrecords TEST
\addtocounter{@record}{1}%
\expandafter\g@addto@macro\expandafter#2\expandafter{\rdar@fileline}%
\ifx\rdar@fileline\empty\else\expandafter\g@addto@macro%
\expandafter#2\expandafter{\read@array@sepchar}%\fi% <---DON'T \fi HERE
\if T\first@row\read@array{#2}\setcounter{@col}{\numexpr(\Arg@listlen-1)}%
\edef\ncols{\arabic{@col}}\def\first@row{F}\setcounter{@row}{1}%
\else%
\if T\first@plane%
\ifx\rdar@fileline\empty
\edef\nrows{\arabic{@row}}\def\first@plane{F}%
\else
\addtocounter{@row}{1}%
\fi
\fi%
\fi%
\fi% <---EXTEND \fi TO HERE TO NOT ANALYZE INITIAL BLANK LINE
\def\record@name{\csname #3[\the@record]\endcsname}%
\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter%
\expandafter\def\expandafter\record@name\expandafter{\rdar@fileline}%
\fi% FINISH \ifignoreblankreadarrayrecords TEST
\repeat%
\edef\nrecords{\arabic{@record}}%
\expandafter\edef\csname #3PLANES\endcsname{0}%
\expandafter\edef\csname #3ROWS\endcsname{\nrecords}%
\expandafter\edef\csname #3COLS\endcsname{0}%
\expandafter\edef\csname #3CELLS\endcsname{\nrecords}%
\closein\rdar@file%
\catcode\endlinechar=5 %
\define@rootmacro{#3}%
}
\makeatother
\renewcommand\typesetrowsepchar{\}
\renewcommand\typesetcolsepchar{&}
\begin{document}
\readarraysepchar{=}
Ignore blank records: TRUE
\ignoreblankreadarrayrecordstrue
\readdef{databaseA.csv}\dbA
1st array record is ``\ArrayRecord[1]''
2nd array record is ``\ArrayRecord[2]''
\readarray\dbA\arrayA[-,\ncols]
\begin{tabular}{cc}
\hline
\typesetarray\arrayA\
\hline
\end{tabular}
\bigskip
Ignore blank records: FALSE
\ignoreblankreadarrayrecordsfalse
\readdef{databaseA.csv}\dbA
2nd array record is ``\ArrayRecord[2]''
4th array record is ``\ArrayRecord[4]''
\readarray\dbA\arrayA[-,\ncols]
\begin{tabular}{cc}
\hline
\typesetarray\arrayA\
\hline
\end{tabular}
\end{document}
