Truncating seems like a good idea for some of the fields, but for connection id it seems like the full name would be more useful.
airflow@313edb656578:~$ airflow connections --list
[2019-01-08 19:56:15,947] {{settings.py:174}} INFO - setting.configure_orm(): Using pool settings. pool_size=5, pool_recycle=1800
[2019-01-08 19:56:16,350] {{__init__.py:51}} INFO - Using executor SequentialExecutor
╒════════════════════════════════╤═════════════════════════╤════════════════════════════════╤════════╤════════════════╤══════════════════════╤════════════════════════════════╕
│ Conn Id │ Conn Type │ Host │ Port │ Is Encrypted │ Is Extra Encrypted │ Extra │
╞════════════════════════════════╪═════════════════════════╪════════════════════════════════╪════════╪════════════════╪══════════════════════╪════════════════════════════════╡
│ 'long_names...are_truncated' │ 'mysql' │ 'localhost' │ None │ True │ False │ None │
╘════════════════════════════════╧═════════════════════════╧════════════════════════════════╧════════╧════════════════╧══════════════════════╧════════════════════════════════╛
At first I thought it was tabulate that was doing the truncating....
In [3]:
# will probably need to pip install this external to jupyter
from tabulate import tabulate
import reprlib
mydict = dict()
In [ ]:
In [4]:
def populate_array(mydict):
for i in range(50):
line = ''
for j in range(50):
line += 'X'
mydict[j] = line
In [5]:
newdict = dict()
populate_array(newdict)
In [6]:
newdict
Out[6]:
In [7]:
mylist = []
for each in newdict:
mylist.append([newdict[each]])
In [8]:
mylist
Out[8]:
In [10]:
# The trucation in airflow connections list is actually caused by use of reprlib, not tabulate
conns = [map(reprlib.repr, conn) for conn in mylist]
In [11]:
conns
Out[11]:
In [ ]:
In [12]:
print (tabulate(conns, tablefmt="fancy_grid"))
So it turns out that the cause of truncation is use of the reprlib
library.
In [ ]: