Skip to content

Commit

Permalink
Merge branch 'dev' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
v1a0 committed Sep 15, 2021
2 parents bea35e9 + 4bee212 commit 7f3a032
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
9 changes: 0 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,3 @@
long_description_content_type='text/markdown',
)
# https://pypi.org/classifiers/

print("""
\t\t\t\33[41m!!!\tWARNING\t!!!\033[0m
\033[91m
SQLLEX v0.2 have major changes that may breaks your old code!
Please, read https://github.com/v1a0/sqllex/blob/main/UPDATES.md#0200
if you are moving from v0.1.10.5 to v0.2+, and open an issue if you have any bugs.
\033[0m\33[93m
Thanks for you support and feedback!\033[0m""")
28 changes: 17 additions & 11 deletions sqllex/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,30 @@
from sqllex.constants import *
from sqllex.debug import logger

print("""
\t\t\t\33[41m!!!\tWARNING\t!!!\033[0m
\033[91m
SQLLEX v0.2 have major changes that may breaks your old code!
Please, read https://github.com/v1a0/sqllex/blob/main/UPDATES.md#0200
if you are moving from v0.1.10.5 to v0.2+, and open an issue if you have any bugs.
\033[0m\33[93m
Thanks for you support and feedback!\033[0m""")
print(
"\033[91m"
"WARNING: SQLLEX v0.2+ have major changes that may breaks your old code! "
"Please, read https://github.com/v1a0/sqllex/blob/main/UPDATES.md#0200. "
"Especially if you are moving v0.1.10.5 -> v0.2+"
"\033[0m"
"\33[93m"
"\n"
"Thanks for you support and feedback!"
"\033[0m"
"\n")

__version__ = '0.2.0.1'
__version__ = '0.2.0.2'

__all__ = [
# classes

# ABC
# "AbstractColumn", # lgtm [py/undefined-export]
# "SearchCondition", # lgtm [py/undefined-export]

# SQLite3x
"SQLite3x", # lgtm [py/undefined-export]
# "SQLite3xTable", # lgtm [py/undefined-export]
# "AbstractColumn", # lgtm [py/undefined-export]
# "SQLite3xSearchCondition", # lgtm [py/undefined-export]

# PostgreSQL
"PostgreSQLx", # lgtm [py/undefined-export]
Expand Down
7 changes: 5 additions & 2 deletions sqllex/core/entities/abc/sql_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def __getitem__(self, key) -> AbstractColumn:
db['table_name']['column_name']
"""
if key not in self.columns_names:
raise KeyError(key, "No such column in table")
raise KeyError(key, f"No such column '{key}' in table '{self.name}'")

return AbstractColumn(table=self.name, name=key)

Expand Down Expand Up @@ -532,6 +532,9 @@ def __getitem__(self, key) -> AbstractTable:
Get table from database
db['table_name']
"""
if key not in self.tables_names:
raise KeyError(key, f"No such table '{key}' in database")

return self._get_table(key)

def __del__(self):
Expand Down Expand Up @@ -1209,7 +1212,7 @@ def get_table(
"""

return self._get_table(name=name)
return self.__getitem__(key=name)

def get_columns(
self,
Expand Down

0 comments on commit 7f3a032

Please sign in to comment.