**kamctl** include a python tool that is parsing SQL statements to do operations over the **db_text** files, for the common db operations (e.g., insert, delete). It is located at:
* https://github.com/kamailio/kamailio/tree/master/utils/kamctl/dbtextdb
The tool was contributed long time ago and not kept up to date, being known not to work with Python3 (e.g., #2464).
This issue is created to see if someone has the interest to pick up the maintenance of this tool, if not it will be removed from kamctl.
Note that db_text works with text files, so it is not necessary to have a tool for managing the content of these files, they can be simply updated with any text editor.
I got same issue here, let me figure out wether can be fixed. ``` bash root@evsio0nHK:~# kamctl add evsio0n 123 Traceback (most recent call last): File "/usr/lib/x86_64-linux-gnu/kamailio//kamctl/dbtextdb/dbtextdb.py", line 1243, in <module> main(sys.argv) File "/usr/lib/x86_64-linux-gnu/kamailio//kamctl/dbtextdb/dbtextdb.py", line 1230, in main dataset = conn.Execute(' '.join(argv[1:])) File "/usr/lib/x86_64-linux-gnu/kamailio//kamctl/dbtextdb/dbtextdb.py", line 423, in Execute self.WriteTempTable() File "/usr/lib/x86_64-linux-gnu/kamailio//kamctl/dbtextdb/dbtextdb.py", line 1138, in WriteTempTable self.temp_file.write(header.strip() + '\n') File "/usr/lib/python3.9/tempfile.py", line 613, in func_wrapper return func(*args, **kwargs) TypeError: a bytes-like object is required, not 'str' ERROR: introducing the new user 'evsio0n' to the database failed root@evsio0nHK:~# ```
Modify two strings: 1138 and 1146 `# cat -n dbtextdb.py | head -n 1146 | tail -n 10 1137 # Modified by Alexander "Ramzes" Rozes to prevent TypeError: a bytes-like object is required, not 'str' 1138 self.temp_file.write((header.strip() + '\n').encode()) 1139 1140 # write data 1141 for row in self.data: 1142 row_str = '' 1143 for col in columns: 1144 row_str = '%s:%s' % (row_str, row[col]) 1145 1146 self.temp_file.write((row_str[1:] + '\n').encode()) # Modified by Alexander "Ramzes" Rozes `
LGTM
Thanks for suggesting the changes, I pushed a commit for them.
I assume now is ok, so I close this one. If not, reopen.
Closed #2469 as completed.