Skip to content

Commit

Permalink
Ensure a column name for no-name columns
Browse files Browse the repository at this point in the history
  • Loading branch information
stonebig committed Feb 4, 2022
1 parent ddf26fd commit 5778070
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 6 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
=========

2022-02-04a : v0.12.2 'Filling the blanks !'
--------------------------------------------

* empty columns names are always replaced per the default 'c_nnn' convention


2021-08-15a : v0.12.1 'Pop-up results to excel !'
-------------------------------------------------

Expand Down
9 changes: 6 additions & 3 deletions sqlite_bro/sqlite_bro.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ class App:

def __init__(self, use_gui=True):
"""create a tkk graphic interface with a main window tk_win"""
self.__version__ = "0.12.1"
self._title = "of 2021-08-15a : 'Pop-up results to .excel !'"
self.__version__ = "0.12.2"
self._title = "of 2022-02-04a : 'Filling the blanks !'"
self.conn = None # Baresql database object
self.database_file = ""
self.initialdir = "."
Expand Down Expand Up @@ -1619,7 +1619,10 @@ def guess_sql_creation(table_name, separ, decim, header, data, quoter='"'):
if header:
# de-duplicate column names, if needed by pastixing with '_'+number
for i in range(len(r)):
if r[i] in r[:i]:

if r[i] == "": # 2022-02-04a replace empty column title per usual default

r[i] = "c_" + ("000" + str(i))[-3:] if r[i] in r[:i]:
j = 1
while r[i] + "_" + str(j) in r[:i] + r[i + 1 :]:
j += 1
Expand Down

0 comments on commit 5778070

Please sign in to comment.