@testing.provide_metadata
def test_nullable_reflection(self):
    'test reflection of NULL/NOT NULL, in particular with TIMESTAMP\n        defaults where MySQL is inconsistent in how it reports CREATE TABLE.\n\n        '
    meta = self.metadata
    row = testing.db.execute("show variables like '%%explicit_defaults_for_timestamp%%'").first()
    explicit_defaults_for_timestamp = (row[1].lower() in ('on', '1', 'true'))
    reflected = []
    for (idx, cols) in enumerate([['x INTEGER NULL', 'y INTEGER NOT NULL', 'z INTEGER', 'q TIMESTAMP NULL'], ['p TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP'], ['r TIMESTAMP NOT NULL'], ['s TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP'], ['t TIMESTAMP'], ['u TIMESTAMP DEFAULT CURRENT_TIMESTAMP']]):
        Table(('nn_t%d' % idx), meta)
        testing.db.execute(('\n                CREATE TABLE nn_t%d (\n                    %s\n                )\n            ' % (idx, ', \n'.join(cols))))
        reflected.extend(({'name': d['name'], 'nullable': d['nullable'], 'default': d['default']} for d in inspect(testing.db).get_columns(('nn_t%d' % idx))))
    if testing.db.dialect._is_mariadb_102:
        current_timestamp = 'current_timestamp()'
    else:
        current_timestamp = 'CURRENT_TIMESTAMP'
    eq_(reflected, [{'name': 'x', 'nullable': True, 'default': None}, {'name': 'y', 'nullable': False, 'default': None}, {'name': 'z', 'nullable': True, 'default': None}, {'name': 'q', 'nullable': True, 'default': None}, {'name': 'p', 'nullable': True, 'default': current_timestamp}, {'name': 'r', 'nullable': False, 'default': (None if explicit_defaults_for_timestamp else ('%(current_timestamp)s ON UPDATE %(current_timestamp)s' % {'current_timestamp': current_timestamp}))}, {'name': 's', 'nullable': False, 'default': current_timestamp}, {'name': 't', 'nullable': (True if explicit_defaults_for_timestamp else False), 'default': (None if explicit_defaults_for_timestamp else ('%(current_timestamp)s ON UPDATE %(current_timestamp)s' % {'current_timestamp': current_timestamp}))}, {'name': 'u', 'nullable': (True if explicit_defaults_for_timestamp else False), 'default': current_timestamp}])
test reflection of NULL/NOT NULL, in particular with TIMESTAMP
defaults where MySQL is inconsistent in how it reports CREATE TABLE.
@testing.provide_metadata
def test_nullable_reflection(self):
    'test reflection of NULL/NOT NULL, in particular with TIMESTAMP\n        defaults where MySQL is inconsistent in how it reports CREATE TABLE.\n\n        '
    meta = self.metadata
    row = testing.db.execute("show variables like '%%explicit_defaults_for_timestamp%%'").first()
    explicit_defaults_for_timestamp = (row[1].lower() in ('on', '1', 'true'))
    reflected = []
    for (idx, cols) in enumerate([['x INTEGER NULL', 'y INTEGER NOT NULL', 'z INTEGER', 'q TIMESTAMP NULL'], ['p TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP'], ['r TIMESTAMP NOT NULL'], ['s TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP'], ['t TIMESTAMP'], ['u TIMESTAMP DEFAULT CURRENT_TIMESTAMP']]):
        Table(('nn_t%d' % idx), meta)
        testing.db.execute(('\n                CREATE TABLE nn_t%d (\n                    %s\n                )\n            ' % (idx, ', \n'.join(cols))))
        reflected.extend(({'name': d['name'], 'nullable': d['nullable'], 'default': d['default']} for d in inspect(testing.db).get_columns(('nn_t%d' % idx))))
    if testing.db.dialect._is_mariadb_102:
        current_timestamp = 'current_timestamp()'
    else:
        current_timestamp = 'CURRENT_TIMESTAMP'
    eq_(reflected, [{'name': 'x', 'nullable': True, 'default': None}, {'name': 'y', 'nullable': False, 'default': None}, {'name': 'z', 'nullable': True, 'default': None}, {'name': 'q', 'nullable': True, 'default': None}, {'name': 'p', 'nullable': True, 'default': current_timestamp}, {'name': 'r', 'nullable': False, 'default': (None if explicit_defaults_for_timestamp else ('%(current_timestamp)s ON UPDATE %(current_timestamp)s' % {'current_timestamp': current_timestamp}))}, {'name': 's', 'nullable': False, 'default': current_timestamp}, {'name': 't', 'nullable': (True if explicit_defaults_for_timestamp else False), 'default': (None if explicit_defaults_for_timestamp else ('%(current_timestamp)s ON UPDATE %(current_timestamp)s' % {'current_timestamp': current_timestamp}))}, {'name': 'u', 'nullable': (True if explicit_defaults_for_timestamp else False), 'default': current_timestamp}])