Skip to content

Commit

Permalink
Merge pull request #75 from opengisch/fix_createbasket
Browse files Browse the repository at this point in the history
Fix numeric check for tilitid values
signedav authored Nov 24, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents 5ee9972 + 90462e8 commit d1d873c
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion modelbaker/dbconnector/gpkg_connector.py
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@
***************************************************************************/
"""
import errno
import numbers
import os
import re
import sqlite3
@@ -883,7 +884,7 @@ def create_basket(self, dataset_tid, topic, tilitid_value=None):
if not tilitid_value:
# default value
tilitid_value = f"'{uuid.uuid4()}'"
elif not tilitid_value.isnumeric():
elif not isinstance(tilitid_value, numbers.Number):
tilitid_value = f"'{tilitid_value}'"
cursor.execute(
"""
3 changes: 2 additions & 1 deletion modelbaker/dbconnector/mssql_connector.py
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@
***************************************************************************/
"""

import numbers
import re

import pyodbc
@@ -984,7 +985,7 @@ def create_basket(self, dataset_tid, topic, tilitid_value=None):
if not tilitid_value:
# default value
tilitid_value = "NEWID()"
elif not tilitid_value.isnumeric():
elif not isinstance(tilitid_value, numbers.Number):
tilitid_value = f"'{tilitid_value}'"
cur.execute(
"""
3 changes: 2 additions & 1 deletion modelbaker/dbconnector/pg_connector.py
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@
***************************************************************************/
"""
import logging
import numbers
import re

import psycopg2
@@ -1023,7 +1024,7 @@ def create_basket(self, dataset_tid, topic, tilitid_value=None):
if not tilitid_value:
# default value
tilitid_value = "uuid_generate_v4()"
elif not tilitid_value.isnumeric():
elif not isinstance(tilitid_value, numbers.Number):
tilitid_value = f"'{tilitid_value}'"
cur.execute(
"""

0 comments on commit d1d873c

Please sign in to comment.