Skip to content

Commit

Permalink
Added unit test for testing insert statements on Map data type.
Browse files Browse the repository at this point in the history
  • Loading branch information
subkanthi committed Oct 4, 2023
1 parent 7247d3e commit d0290c0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/sql/test_insert.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,21 @@ def test_insert(self):

rv = self.session.execute(select(table.c.x)).scalar()
self.assertEqual(rv, 'test')

@require_server_version(19, 3, 3)
def test_insert_map(self):
table = Table(
't', self.metadata(),
Column('x', types.Map(types.String, types.Int32), primary_key=True),
engines.Memory()
)

with self.create_table(table):
dict_map = dict(key1=1, Key2=2)
x = [
{'x': dict_map}
]
self.session.execute(table.insert(), x)

rv = self.session.execute(select(table.c.x)).scalar()
self.assertEqual(rv, dict_map)

0 comments on commit d0290c0

Please sign in to comment.