How to use delete_rule method in localstack

Best Python code snippet using localstack_python

__init__.pyi

Source:__init__.pyi Github

copy

Full Screen

1# coding: utf-82#3# Copyright 2022 :Barry-Thomas-Paul: Moss4#5# Licensed under the Apache License, Version 2.0 (the "License")6# you may not use this file except in compliance with the License.7# You may obtain a copy of the License at8#9# http: // www.apache.org/licenses/LICENSE-2.010#11# Unless required by applicable law or agreed to in writing, software12# distributed under the License is distributed on an "AS IS" BASIS,13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.14# See the License for the specific language governing permissions and15# limitations under the License.16#17# Const18# this is a auto generated file generated by Cheetah19# Libre Office Version: 7.320# Namespace: com.sun.star.sdbc21from typing_extensions import Literal22"""23Const24determines the rules for foreign key constraints.25See Also:26 `API KeyRule <https://api.libreoffice.org/docs/idl/ref/namespacecom_1_1sun_1_1star_1_1sdbc_1_1KeyRule.html>`_27"""28CASCADE: Literal[0]29"""30a possible value for the column's UPDATE_RULE and DELETE_RULE in the com.sun.star.sdbc.XResultSet objects returned by the methods com.sun.star.sdbc.XDatabaseMetaData.getImportedKeys(), com.sun.star.sdbc.XDatabaseMetaData.getExportedKeys(), and com.sun.star.sdbc.XDatabaseMetaData.getCrossReference().31For the column UPDATE_RULE , it indicates that when the primary key is updated, the foreign key (imported key) is changed to agree with it.32For the column DELETE_RULE , it indicates that when the primary key is deleted, rows that imported that key are deleted.33"""34RESTRICT: Literal[1]35"""36a possible value for the column's UPDATE_RULE and DELETE_RULE in the com.sun.star.sdbc.XResultSet objects returned by the methods com.sun.star.sdbc.XDatabaseMetaData.getImportedKeys(), com.sun.star.sdbc.XDatabaseMetaData.getExportedKeys(), and com.sun.star.sdbc.XDatabaseMetaData.getCrossReference().37For the column UPDATE_RULE , it indicates that a primary key may not be updated if it has been imported by another table as a foreign key.38For the column DELETE_RULE , it indicates that a primary key may not be deleted if it has been imported by another table as a foreign key.39"""40SET_NULL: Literal[2]41"""42a possible value for the column's UPDATE_RULE and DELETE_RULE in the com.sun.star.sdbc.XResultSet objects returned by the methods com.sun.star.sdbc.XDatabaseMetaData.getImportedKeys(), com.sun.star.sdbc.XDatabaseMetaData.getExportedKeys(), and com.sun.star.sdbc.XDatabaseMetaData.getCrossReference().43For the columns UPDATE_RULE and DELETE_RULE , it indicates that when the primary key is updated or deleted, the foreign key (imported key) is changed to NULL.44"""45NO_ACTION: Literal[3]46"""47a possible value for the column's UPDATE_RULE and DELETE_RULE in the com.sun.star.sdbc.XResultSet objects returned by the methods com.sun.star.sdbc.XDatabaseMetaData.getImportedKeys(), com.sun.star.sdbc.XDatabaseMetaData.getExportedKeys(), and com.sun.star.sdbc.XDatabaseMetaData.getCrossReference().48For the columns UPDATE_RULE and DELETE_RULE , it indicates that if the primary key has been imported, it cannot be updated or deleted.49"""50SET_DEFAULT: Literal[4]51"""52a possible value for the column's UPDATE_RULE and DELETE_RULE in the com.sun.star.sdbc.XResultSet objects returned by the methods com.sun.star.sdbc.XDatabaseMetaData.getImportedKeys(), com.sun.star.sdbc.XDatabaseMetaData.getExportedKeys(), and com.sun.star.sdbc.XDatabaseMetaData.getCrossReference().53For the columns UPDATE_RULE and DELETE_RULE , it indicates that if the primary key is updated or deleted, the foreign key (imported key) is set to the default value....

Full Screen

Full Screen

constraint.py

Source:constraint.py Github

copy

Full Screen

1from .table import Table2class ForeignKeyConstraint:3 imported_key_cascade = "0"4 imported_key_restrict = "1"5 imported_key_set_null = "2"6 imported_key_no_action = "3"7 def __init__(self, child: Table, name: str, delete_rule: str, update_rule: str):8 self.name = name.replace("'", "")9 self.delete_rule = delete_rule10 self.update_rule = update_rule11 self.parent_columns = []12 self.child_columns = []13 self.parent_table = None14 self.child_table = child15 def add_parent_column(self, column):16 if column is not None:17 self.parent_columns.append(column)18 self.parent_table = column.table19 def add_child_column(self, column):20 if column is not None:21 self.child_columns.append(column)22 def get_parent_table(self):23 return self.parent_table24 def get_child_table(self):25 return self.child_table26 def is_cascade_on_delete(self):27 return self.delete_rule == self.imported_key_cascade28 def is_restrict_delete(self):29 return (30 self.delete_rule == self.imported_key_no_action31 or self.delete_rule == self.imported_key_restrict32 )33 def is_null_on_delete(self):34 return self.delete_rule == self.imported_key_set_null35 def get_delete_rule_name(self):36 if self.delete_rule == self.imported_key_cascade:37 return "Cascade on delete"38 elif (39 self.delete_rule == self.imported_key_restrict40 or self.delete_rule == self.imported_key_no_action41 ):42 return "Restrict delete"43 elif self.delete_rule == self.imported_key_set_null:44 return "Null on delete"45 else:46 return ""47 def get_delete_rule_description(self):48 if self.delete_rule == self.imported_key_cascade:49 return "Cascade on delete:\nDeletion of parent deletes child"50 elif (51 self.delete_rule == self.imported_key_restrict52 or self.delete_rule == self.imported_key_no_action53 ):54 return "Restrict delete:\nParent cannot be deleted if children exist"55 elif self.delete_rule == self.imported_key_set_null:56 return "Null on delete:\nForeign key to parent set to NULL when parent deleted"57 else:58 return ""59 def get_delete_rule_alias(self):60 if self.delete_rule == self.imported_key_cascade:61 return "C"62 elif (63 self.delete_rule == self.imported_key_restrict64 or self.delete_rule == self.imported_key_no_action65 ):66 return "R"67 elif self.delete_rule == self.imported_key_set_null:68 return "N"69 else:70 return ""71 @staticmethod72 def get_all_foreign_key_constraints(tables):73 constraints = []74 for table in tables:75 constraints.extend(table.get_foreign_keys())...

Full Screen

Full Screen

FPDeleteRule_test.py

Source:FPDeleteRule_test.py Github

copy

Full Screen

...10 - Validating the outputs as expected.11 """12 from FPDeleteRule import delete_rule13 results_mock = mocker.patch.object(demisto, 'results')14 delete_rule('wrong_type')15 assert 'Type argument must be "dest_domain", "dest_ip", "dest_host" or "url_regex". Invalid value: ' \16 in results_mock.call_args[0][0]['Contents']17def test_delete_rule(mocker):18 """19 Given:20 - The script args.21 When:22 - Running delete_rule function.23 Then:24 - Validating the outputs as expected.25 """26 from FPDeleteRule import delete_rule27 mocker.patch.object(demisto, 'args', return_value={'tritonsystem': 'tritonsystem',28 'value': 'system'})29 execute_command_res = [{'Type': 1, 'Contents': {'success': 'true'}}]30 execute_mock = mocker.patch.object(demisto, 'executeCommand', return_value=execute_command_res)31 results_mock = mocker.patch.object(demisto, 'results')32 delete_rule("dest_domain")33 assert execute_mock.call_count == 1...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful