greenplum-db / greenplumpython Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
i am using the python3 shell to try out a greenplumpython that i built myself. python version 3.6.8.
$ python3
>>> import pandas as pd
>>> import greenplumpython as gppy
>>> connection = gppy.GPConnection()
>>> conn = connection.connect( 'localhost', 6000, 'testdb', 'gpadmin', '')
>>> testdb_inst = gppy.GPDatabase(conn)
>>> dfwrap_table1 = testdb_inst.get_table( 'table1', 'public')
>>> otbl_cols = list()
>>> otuple = ('c1', 'int')
>>> otbl_cols.append(otuple)
>>> otbl_meta = gppy.GPTableMetadata(None, otbl_cols, None)
>>> # apply function
... def input_py_func(row_element, extra_args):
... return row_element + extra_args
...
>>> df = gppy.gpApply(dfwrap_table1, input_py_func, testdb_inst, otbl_meta, 'plc_python_shared')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/gpadmin/GreenplumPython/greenplumpython/core/gpapply.py", line 39, in gpApply
s = inspect.getsource(py_func)
File "/usr/lib64/python3.6/inspect.py", line 973, in getsource
lines, lnum = getsourcelines(object)
File "/usr/lib64/python3.6/inspect.py", line 955, in getsourcelines
lines, lnum = findsource(object)
File "/usr/lib64/python3.6/inspect.py", line 786, in findsource
raise OSError('could not get source code')
OSError: could not get source code
this may be related: https://stackoverflow.com/questions/57035364/inspect-getsourcelinesobject-shows-oserror-if-run-from-python-shell-but-gives
should gpApply() work when the function is defined inline in the shell work? or do i need to define the function in a script?
When running multiple notebooks at the same time using GreenplumPython, the backend pid of the session has changed while the db
object id remains the same. I add that there is no session disconnection happend between the changes.
Session of the starting current notebook:
BACKEND SESSION PID: [RealDictRow([('pg_backend_pid', 11777)])]
DB OBJECT ID: 140420733129040
CREATE FUNCTION "pg_temp"."func_f8e86dfce7934fb98e098e9cc0eb75d6" (date "text") RETURNS "text" AS $$
After running several cells, the session pid has changed, which refers to another notebook's session:
BACKEND SESSION PID: [RealDictRow([('pg_backend_pid', 11780)])]
DB OBJECT ID: 140420733129040
function pg_temp.func_f8e86dfce7934fb98e098e9cc0eb75d6(text) does not exist
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.