You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#58 i am facing some problem to solve this issue when i run this code it accepts only exact table name for example we have table whose name is 'class' and when i write table name like (Class,CLASS,classes) it is not giving me the output although i am using [flags=re.IGNORRECASE] how to solve this issue please help me.
def create_table(self, table_string):
lines = table_string.split("\n")
table = Table()
for line in lines:
if 'TABLE' in line:
table_name = re.search("`(\w+)`", line,flags=re.IGNORECASE)
table.name = table_name.group(1)
if self.thesaurus_object is not None:
table.equivalences = self.thesaurus_object.get_synonyms_of_a_word(table.name)
elif 'PRIMARY KEY' in line:
primary_key_columns = re.findall("`(\w+)`", line,flags=re.IGNORECASE)
for primary_key_column in primary_key_columns:
table.add_primary_key(primary_key_column)
else:
column_name = re.search("`(\w+)`", line,flags=re.IGNORECASE)
if column_name is not None:
column_type = self.predict_type(line)
if self.thesaurus_object is not None:
equivalences = self.thesaurus_object.get_synonyms_of_a_word(column_name.group(1))
else:
equivalences = []
table.add_column(column_name.group(1), column_type, equivalences)
return table
def alter_table(self, alter_string):
lines = alter_string.replace('\n', ' ').split(';')
for line in lines:
if 'PRIMARY KEY' in line:
table_name = re.search("TABLE `(\w+)`", line,flags=re.IGNORECASE).group(1)
table = self.get_table_by_name(table_name)
primary_key_columns = re.findall("PRIMARY KEY \(`(\w+)`\)", line,flags=re.IGNORECASE)
for primary_key_column in primary_key_columns:
table.add_primary_key(primary_key_column)
elif 'FOREIGN KEY' in line:
table_name = re.search("TABLE `(\w+)`", line,flags=re.IGNORECASE).group(1)
table = self.get_table_by_name(table_name)
foreign_keys_list = re.findall("FOREIGN KEY \(`(\w+)`\) REFERENCES `(\w+)` \(`(\w+)`\)", line,flags=re.IGNORECASE)
for column, foreign_table, foreign_column in foreign_keys_list:
table.add_foreign_key(column, foreign_table, **foreign_column)**
The text was updated successfully, but these errors were encountered:
#58 i am facing some problem to solve this issue when i run this code it accepts only exact table name for example we have table whose name is 'class' and when i write table name like (Class,CLASS,classes) it is not giving me the output although i am using [flags=re.IGNORRECASE] how to solve this issue please help me.
The text was updated successfully, but these errors were encountered: