Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions tpcc/pytpcc/drivers/typedb3driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def loadConfig(self, config):
credentials = Credentials(self.user, self.password)

if self.edition is EDITION.Core:
self.driver = TypeDB.driver(address=f"{self.addr}", credentials=credentials, driver_options=DriverOptions())
self.driver = TypeDB.driver(address=f"{self.addr}", credentials=credentials, driver_options=DriverOptions(is_tls_enabled=False))
if self.edition is EDITION.Cloud:
raise "Unimplemented"

Expand Down Expand Up @@ -539,7 +539,7 @@ def doNewOrder(self, params):
q = f"""
match
$w isa WAREHOUSE, has W_ID {w_id}, has W_TAX $w_tax;
$d isa DISTRICT, has D_ID {w_id * DPW + d_id}, has D_TAX $d_tax, has D_NEXT_O_ID $d_next_o_id;
$d isa DISTRICT, links (warehouse: $w), has D_ID {w_id * DPW + d_id}, has D_TAX $d_tax, has D_NEXT_O_ID $d_next_o_id;
$c isa CUSTOMER, has C_ID {w_id * DPW * CPD + d_id * CPD + c_id},
has C_DISCOUNT $c_discount, has C_LAST $c_last, has C_CREDIT $c_credit;
let $d_next_o_id_old = $d_next_o_id;
Expand Down Expand Up @@ -632,7 +632,7 @@ def doNewOrder(self, params):
match
$i isa ITEM, has I_ID {ol_i_id};
$w isa WAREHOUSE, has W_ID {ol_supply_w_id};
$d isa DISTRICT, has D_ID {w_id * DPW + d_id};
$d isa DISTRICT, links (warehouse: $w), has D_ID {w_id * DPW + d_id};
$o links (district: $d), isa ORDER, has O_ID {d_next_o_id};
$s links (item: $i, warehouse: $w), isa STOCKING,
has S_QUANTITY $s_quantity, has S_YTD $s_ytd,
Expand Down Expand Up @@ -695,7 +695,8 @@ def doDelivery(self, params):
for d_id in range(1, constants.DISTRICTS_PER_WAREHOUSE+1):
q = f"""
match
$d isa DISTRICT, has D_ID {w_id * DPW + d_id};
$w isa WAREHOUSE, has W_ID { w_id };
Copy link

Copilot AI Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Inconsistent spacing around the variable in the query. The space after the opening brace and before the closing brace should be removed to match the formatting used elsewhere in the file.

Copilot uses AI. Check for mistakes.

$d isa DISTRICT, links (warehouse: $w), has D_ID {w_id * DPW + d_id};
$o links (customer: $c, district: $d), isa ORDER, has O_ID $o_id, has O_NEW_ORDER true;
$c isa CUSTOMER, has C_ID $c_id;
select $o_id, $c_id;
Expand All @@ -717,7 +718,8 @@ def doDelivery(self, params):

q = f"""
match
$d isa DISTRICT, has D_ID {w_id * DPW + d_id};
$w isa WAREHOUSE, has W_ID { w_id };
Copy link

Copilot AI Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Inconsistent spacing around the variable in the query. The space after the opening brace and before the closing brace should be removed to match the formatting used elsewhere in the file.

Copilot uses AI. Check for mistakes.

$d isa DISTRICT, links (warehouse: $w), has D_ID {w_id * DPW + d_id};
$o links (district: $d), isa ORDER, has O_ID {no_o_id};
$ol links (order: $o, item: $i), isa ORDER_LINE, has OL_AMOUNT $ol_amount;
select $ol_amount;
Expand Down Expand Up @@ -822,7 +824,8 @@ def doOrderStatus(self, params):
# TODO: check whether it's faster to constrain customer through C_ID range
q = f"""
match
$d isa DISTRICT, has D_ID {w_id * DPW + d_id};
$w isa WAREHOUSE, has W_ID { w_id };
Copy link

Copilot AI Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Inconsistent spacing around the variable in the query. The space after the opening brace and before the closing brace should be removed to match the formatting used elsewhere in the file.

Copilot uses AI. Check for mistakes.

$d isa DISTRICT, links (warehouse: $w), has D_ID {w_id * DPW + d_id};
$c links (district: $d), isa CUSTOMER, has C_ID $c_id,
has C_FIRST $c_first, has C_MIDDLE $c_middle, has C_LAST $c_last,
has C_BALANCE $c_balance;
Expand Down Expand Up @@ -949,7 +952,8 @@ def doPayment(self, params):
# TODO: check whether it's faster to constrain customer through C_ID range
q = f"""
match
$d isa DISTRICT, has D_ID {w_id * DPW + d_id};
$w isa WAREHOUSE, has W_ID { w_id };
Copy link

Copilot AI Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Inconsistent spacing around the variable in the query. The space after the opening brace and before the closing brace should be removed to match the formatting used elsewhere in the file.

Copilot uses AI. Check for mistakes.

$d isa DISTRICT, links (warehouse: $w), has D_ID {w_id * DPW + d_id};
$c links (district: $d), isa CUSTOMER, has C_ID $c_id,
has C_FIRST $c_first, has C_MIDDLE $c_middle, has C_LAST $c_last,
has C_STREET_1 $c_street_1, has C_STREET_2 $c_street_2, has C_CITY $c_city,
Expand Down Expand Up @@ -1033,7 +1037,8 @@ def doPayment(self, params):
# D_NAME, D_STREET_1, D_STREET_2, D_CITY, D_STATE, D_ZIP
q = f"""
match
$d isa DISTRICT, has D_ID {w_id * DPW + d_id},
$w isa WAREHOUSE, has W_ID { w_id };
Copy link

Copilot AI Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Inconsistent spacing around the variable in the query. The space after the opening brace and before the closing brace should be removed to match the formatting used elsewhere in the file.

Copilot uses AI. Check for mistakes.

$d isa DISTRICT, links (warehouse: $w), has D_ID {w_id * DPW + d_id},
has D_NAME $d_name, has D_STREET_1 $d_street_1,
has D_STREET_2 $d_street_2, has D_CITY $d_city,
has D_STATE $d_state, has D_ZIP $d_zip, has D_YTD $d_ytd;
Expand Down Expand Up @@ -1166,7 +1171,8 @@ def doStockLevel(self, params):
with self.driver.transaction(self.database, TransactionType.WRITE) as tx:
q = f"""
match
$d isa DISTRICT, has D_ID {w_id * DPW + d_id}, has D_NEXT_O_ID $d_next_o_id;
$w isa WAREHOUSE, has W_ID { w_id };
Copy link

Copilot AI Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Inconsistent spacing around the variable in the query. The space after the opening brace and before the closing brace should be removed to match the formatting used elsewhere in the file.

Copilot uses AI. Check for mistakes.

$d isa DISTRICT, links (warehouse: $w), has D_ID {w_id * DPW + d_id}, has D_NEXT_O_ID $d_next_o_id;
select $d_next_o_id;
"""
self.start_checkpoint(q)
Expand All @@ -1182,7 +1188,7 @@ def doStockLevel(self, params):
q = f"""
match
$w isa WAREHOUSE, has W_ID {w_id};
$d isa DISTRICT, has D_ID {w_id * DPW + d_id};
$d isa DISTRICT, links (warehouse: $w), has D_ID {w_id * DPW + d_id};
$s links (item: $i, warehouse: $w), isa STOCKING, has S_QUANTITY < {threshold};
$ol links (item: $i, order: $o), isa ORDER_LINE;
$o links (district: $d), isa ORDER, has O_ID $o_id;
Expand Down