Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot visualize the customer demographics and trading activity data with Db2 datasource #33

Open
farnaudies opened this issue Jan 25, 2021 · 3 comments

Comments

@farnaudies
Copy link

#############

Db2 Connection and Dataset data_df_1 then df_churn_pd = data_df_1

##############

use "Insert to code" and "pandas DataFrame"

to import the input data into the notebook.

Add asset from file system# @hidden_cell

from project_lib import Project
project = Project.access()

Db2Wh_5nodes_metadata = project.get_connection(name="Db2Wh-5nodes")

import os, jaydebeapi, pandas as pd

Db2Wh_5nodes_url = 'jdbc:db2://{}:{}/{}'.format(
Db2Wh_5nodes_metadata['host'],
Db2Wh_5nodes_metadata.get('port', 50000),
Db2Wh_5nodes_metadata['database']
)

Db2Wh_5nodes_connection = jaydebeapi.connect(
'com.ibm.db2.jcc.DB2Driver',
Db2Wh_5nodes_url,
[Db2Wh_5nodes_metadata['xxxxx'],Db2Wh_5nodes_metadata['yyyyy']]
)

query = 'SELECT * FROM "CHURN"."MERGED_CUSTOMERS"'
data_df_1 = pd.read_sql_query(query, con=Db2Wh_5nodes_connection)
data_df_1.head()

##########################
Error Step 3


TypeError Traceback (most recent call last)
in
----> 1 get_ipython().run_line_magic('brunel', "data('df_churn_pd') stack polar bar x(CHURNRISK) y(#count) color(CHURNRISK) bar tooltip(#all) :: width=300, height=300")

/opt/conda/envs/Python-3.7-main/lib/python3.7/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
2315 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
2316 with self.builtin_trap:
-> 2317 result = fn(*args, **kwargs)
2318 return result
2319

in brunel(self, line, cell)

/opt/conda/envs/Python-3.7-main/lib/python3.7/site-packages/IPython/core/magic.py in (f, *a, **k)
185 # but it's overkill for just that one bit of state.
186 def magic_deco(arg):
--> 187 call = lambda f, *a, **k: f(*a, **k)
188
189 if callable(arg):

~/.local/lib/python3.7/site-packages/brunel/magics.py in brunel(self, line, cell)
43 parts = line.split('::')
44 action = parts[0].strip()
---> 45 datasets_in_brunel = brunel.get_dataset_names(action)
46 self.cache_data(datasets_in_brunel,datas)
47 if len(parts) > 2:

~/.local/lib/python3.7/site-packages/brunel/brunel.py in get_dataset_names(brunel_src)
92
93 def get_dataset_names(brunel_src):
---> 94 return brunel_util_java.D3Integration.getDatasetNames(brunel_src)
95
96 def cacheData(data_key, data):

~/.local/lib/python3.7/site-packages/jpype/_jpackage.py in call(self, *arg, **kwarg)
54
55 def call(self, *arg, **kwarg):
---> 56 raise TypeError("Package {0} is not Callable".format(self.__name))

TypeError: Package org.brunel.util.D3Integration.getDatasetNames is not Callable

@Thrameos
Copy link

What version of JPype is being used? This error looks like what happens when a dependency is missing (so it can't find the jar) with version 0.7.x or earlier and a JPackage automatically assumed that getDatasetNames is a package as a result.

For the user, make sure that you have all the required jars.

For the developer, consider upgrading to JPype 1.2.x series and using the import system rather than JPackage. It would have detected the missing dependency and then reported a more specific error.

@farnaudies
Copy link
Author

farnaudies commented Jan 27, 2021 via email

@Thrameos
Copy link

Sorry cant help beyond fixing the source if the error message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants