Fix SQLAlchemy: CAST(:ip AS inet) au lieu de :ip::inet (conflit avec bind marker)
This commit is contained in:
parent
e2f61af818
commit
b66ef0a122
@ -78,7 +78,7 @@ def main():
|
||||
try:
|
||||
# Check existant
|
||||
existing = conn.execute(text(
|
||||
"SELECT id FROM server_ips WHERE server_id=:sid AND ip_address=:ip::inet"
|
||||
"SELECT id FROM server_ips WHERE server_id=:sid AND ip_address=CAST(:ip AS inet)"
|
||||
), {"sid": srv.id, "ip": ip_val}).fetchone()
|
||||
if existing:
|
||||
if vrf:
|
||||
@ -89,7 +89,7 @@ def main():
|
||||
else:
|
||||
conn.execute(text("""
|
||||
INSERT INTO server_ips (server_id, ip_address, is_primary, vrf)
|
||||
VALUES (:sid, :ip::inet, :p, :v)
|
||||
VALUES (:sid, CAST(:ip AS inet), :p, :v)
|
||||
"""), {"sid": srv.id, "ip": ip_val, "p": is_primary, "v": vrf})
|
||||
stats["inserted"] += 1
|
||||
except Exception as e:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user