Skip to content

Commit

Permalink
Version 0.1.108, Added Help for Logging and bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mbnshtck committed Dec 11, 2019
1 parent cf60e12 commit 87a73b9
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 20 deletions.
12 changes: 12 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# HISTORY

## Version 0.1.108

- ### New help information

- help on how to enable logging. try %kql --help "logging"

- ### Fix
- Fixed KQLMAGIC_CONNECTION_STR missing options bug
- Fixed missing Orca bug
- Fixed deep linking bug
- Fixed faq display bug

## Version 0.1.107

- ### New feature - request headers tagging
Expand Down
1 change: 1 addition & 0 deletions azure/Kqlmagic/bug_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def _implementation_info() -> dict:

elif implementation == 'PyPy':
implementation_version = f'{sys.pypy_version_info.major}.{sys.pypy_version_info.minor}.{sys.pypy_version_info.micro}'

if sys.pypy_version_info.releaselevel != 'final':
implementation_version = ''.join([
implementation_version, sys.pypy_version_info.releaselevel
Expand Down
5 changes: 5 additions & 0 deletions azure/Kqlmagic/cache_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def __init__(self):
cluster_folder : str
folder that contains all the database_folders that contains the query result files
"""

ip = get_ipython() # pylint: disable=undefined-variable
root_path = ip.starting_dir
cache_folder_name = ip.run_line_magic("config", f"{Constants.MAGIC_CLASS_NAME}.cache_folder_name")
Expand Down Expand Up @@ -55,6 +56,7 @@ def _get_file_path(self, query, database_at_cluster, cache_folder):
if query string ends with the '.json' extension it returns the string
otherwise it computes it from the query
"""

file_name = query if query.strip().endswith(".json") else self._get_query_hash_filename(query)
folder_path = self._get_folder_path(database_at_cluster, cache_folder=cache_folder)
file_path = f"{folder_path}/{file_name}"
Expand All @@ -77,6 +79,7 @@ def _get_folder_path(self, database_at_cluster, cache_folder=None):
if not os.path.exists(folder_path):
os.makedirs(folder_path)
folder_path = f"{folder_path}/{get_valid_filename_with_spaces(database_name)}"

else:
folder_path = database_at_cluster

Expand All @@ -102,6 +105,7 @@ def execute(self, database_at_cluster, query, **options):
:param str database_at_cluster: name of database and cluster that a folder will be derived that contains all the files with the query results for this specific database.
:param str query: Query to be executed or a json file with query results.
"""

file_path = self._get_file_path(query, database_at_cluster, cache_folder=options.get("use_cache"))
str_response = open(file_path, "r").read()
json_response = json.loads(str_response)
Expand Down Expand Up @@ -134,6 +138,7 @@ def save(self, result, conn, query, file_path=None, filefolder=None, **options):
if not os.path.exists(os_folder_name):
os.makedirs(os_folder_name)
file_path = adjust_path(file_path)

else:
database_friendly_name = conn.get_database_friendly_name()
cluster_friendly_name = conn.get_cluster_friendly_name()
Expand Down
1 change: 1 addition & 0 deletions azure/Kqlmagic/column_guesser.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def is_quantity(val) -> bool:
Relies on presence of __sub__.
"""

return hasattr(val, "__sub__")


Expand Down
3 changes: 0 additions & 3 deletions azure/Kqlmagic/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ class Cloud(object):
MOONCAKE = "mooncake"
FAIRFAX = "fairfax"
BLACKFOREST = "blackforest"
USNAT = "usnat"
USSEC = "ussec"
TEST = "test"

class ConnStrKeys(object):
# make sure all keys are lowercase, without spaces, underscores, and hyphen-minus
Expand Down
9 changes: 5 additions & 4 deletions azure/Kqlmagic/kql_magic.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class Kqlmagic(Magics, Configurable):
)

cloud = Enum(
[Cloud.PUBLIC, Cloud.MOONCAKE, Cloud.FAIRFAX, Cloud.BLACKFOREST, Cloud.USNAT, Cloud.USSEC, Cloud.TEST],
[Cloud.PUBLIC, Cloud.MOONCAKE, Cloud.FAIRFAX, Cloud.BLACKFOREST],
Cloud.PUBLIC,
config=True,
help="""Default cloud\n
Expand Down Expand Up @@ -311,14 +311,14 @@ class Kqlmagic(Magics, Configurable):
"auto",
config=True,
help="""Set notebook application used."""
) #TODO: add "papermill"
) #TODO: add "papermill", "nteract"

test_notebook_app = Enum(
["none", "jupyterlab", "jupyternotebook", "ipython", "visualstudiocode"],
"none",
config=True,
help="""Set testing application mode, results should return for the specified notebook application."""
) #TODO: add "papermill"
) #TODO: add "papermill", "nteract"

add_kql_ref_to_help = Bool(
True,
Expand Down Expand Up @@ -648,6 +648,7 @@ def __init__(self, shell):
except:
logger().debug("Kqlmagic::__init__ - failed to fetch PyPi Kqlmagic latest version")
pass

if options.get("show_what_new"):
try:
# What's new (history.md) button #
Expand Down Expand Up @@ -1159,7 +1160,7 @@ def _override_default_configuration(ip, load_mode):
"notebook": "jupyternotebook",
"ipy": "ipython",
"vsc": "visualstudiocode",
# "papermill":"papermill" #TODO: add "papermill"
# "papermill":"papermill" #TODO: add "papermill", "nteract"
}.get(lookup_key)
if app is not None:
ip.run_line_magic("config", f'{Constants.MAGIC_CLASS_NAME}.notebook_app = "{app.strip()}"')
Expand Down
11 changes: 2 additions & 9 deletions azure/Kqlmagic/kusto_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,14 @@ class Kusto_Client(object):
_MOONCAKE_CLOUD_URL_SUFFIX = "chinacloudapi.cn"
_BLACKFOREST_CLOUD_URL_SUFFIX = "cloudapi.de"
_FAIRFAX_CLOUD_URL_SUFFIX = "usgovcloudapi.net"
_USNAT_CLOUD_URL_SUFFIX = "core.eaglex.ic.gov"
_USSEC_CLOUD_URL_SUFFIX = "core.microsoft.scloud"



_CLOUD_URLS = {
Cloud.PUBLIC: _PUBLIC_CLOUD_URL_SUFFIX,
Cloud.MOONCAKE: _MOONCAKE_CLOUD_URL_SUFFIX,
Cloud.FAIRFAX: _FAIRFAX_CLOUD_URL_SUFFIX,
Cloud.BLACKFOREST: _BLACKFOREST_CLOUD_URL_SUFFIX,
Cloud.USNAT: _USNAT_CLOUD_URL_SUFFIX,
Cloud.USSEC: _USSEC_CLOUD_URL_SUFFIX
Cloud.BLACKFOREST: _BLACKFOREST_CLOUD_URL_SUFFIX
}

_DATA_SOURCE_TEMPLATE = "https://{0}.kusto.{1}"
Expand Down Expand Up @@ -122,10 +119,6 @@ def getCloudFromHTTP(self, http: str):
return Cloud.FAIRFAX
if http.endswith(self._BLACKFOREST_CLOUD_URL_SUFFIX):
return Cloud.BLACKFOREST
if http.endswith(self._USNAT_CLOUD_URL_SUFFIX):
return Cloud.USNAT
if http.endswith(self._USSEC_CLOUD_URL_SUFFIX):
return Cloud.USSEC
return Cloud.PUBLIC


Expand Down
3 changes: 1 addition & 2 deletions azure/Kqlmagic/my_aad_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ class AuthenticationMethod(Enum):
Cloud.PUBLIC : 'dsts.core.windows.net',
Cloud.MOONCAKE: 'dsts.core.chinacloudapi.cn',
Cloud.BLACKFOREST: 'dsts.core.cloudapi.de',
Cloud.FAIRFAX: 'dsts.core.usgovcloudapi.net',
Cloud.TEST: 'dsts.core.azure-test.net',
Cloud.FAIRFAX: 'dsts.core.usgovcloudapi.net'
}


Expand Down
2 changes: 1 addition & 1 deletion azure/Kqlmagic/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
from .help import MarkdownString


VERSION = "0.1.107.post2"
VERSION = "0.1.108"


def execute_version_command() -> MarkdownString:
Expand Down
2 changes: 1 addition & 1 deletion binder/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Kqlmagic==0.1.107.post2
Kqlmagic==0.1.108

0 comments on commit 87a73b9

Please sign in to comment.