PyPika is a python SQL query builder that exposes the full richness of the SQL language using a syntax that reflects the resulting query. PyPika excels at all sorts of SQL queries but is especially useful for data analysis.
In [8]: import pypika
In [9]: pypika.__version__
Out[9]: '0.48.9'
In [10]: from ipaddress import IPv4Address
In [11]: print(pypika.PostgreSQLQuery.into(pypika.Table("test_table")).columns('ip').insert(IPv4Address('123.123.123.123')))
INSERT INTO "test_table" ("ip") VALUES (123.123.123.123)
Expected result:
INSERT INTO "test_table" ("ip") VALUES ('123.123.123.123')
Expected result: