I've looked at: https://blogs.msdn.microsoft.com/azuredatalake/2017/03/10/using-custom-python-libraries-with-u-sql/
The blog post mentions that U-SQL's Python extension supports zipimport for custom modules. However, Python's zipimport does not support pyd files (eg compiled C-extensions).
I've tried modifying "UsqlPythonDeployPackage.zip\\3.5.1\\Lib\\site-packages" by adding my modules (downloading the zip file, adding my module, uploading it again), but that didn't seem to work. It doesn't find my pyd-module.
Adding the compiled Python C-extension (pyd) to:
usqlext\assembly\python\UsqlPythonDeployPackage.zip\3.5.1\Lib\site-packages
seems to work just fine. However, I forgot to drop/creating the assembly again. Here's the code I used for that:
CREATE DATABASE IF NOT EXISTS master;
USE DATABASE master;
DROP ASSEMBLY IF EXISTS [ExtPython];
CREATE ASSEMBLY IF NOT EXISTS [ExtPython]
FROM @"/usqlext/assembly/python/ExtPy.dll"
WITH ADDITIONAL_FILES =
(
@"/usqlext/assembly/python/ExtPy.pdb",
@"/usqlext/assembly/python/UsqlPythonInvokePackage.zip",
@"/usqlext/assembly/python/UsqlPythonDeployPackage.zip",
@"/usqlext/assembly/python/version.python"
);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.