

rocuinneagain
Forum Replies Created
-
.Q.chk
adds missing tables, not missing columns.https://code.kx.com/q/ref/dotq/#chk-fill-hdb
Use
addcol
in kdb/utils/dbmaint.md to add columns.Note: this will write to all partitions so ensure you do not overwrite valid data.
https://github.com/KxSystems/kdb/blob/f06c97784b0859517a8461d76607c07a47458ae5/utils/dbmaint.q#L11
add1col
can be used instead to choose which partitions to write to. -
rocuinneagain
MemberAugust 11, 2023 at 12:00 am in reply to: LicenseException: A valid q license must be in a known location (e.g. `$QLIC`) to run q code via ‘pykx.q’.It’s expected that you cannot run pykx.q(‘1+1’) when in unlicensed mode. Can you try again for licensed mode after making a copy of:C:UsersAmod Shankeranaconda3envspython396python.EXE The copy should be python3.EXE:C:UsersAmod Shankeranaconda3envspython396python3.EXE + just to confirm: 1. How did you install PyKX? 2. What version have you installed? pykx.__version__ or view it in conda list
-
rocuinneagain
MemberAugust 10, 2023 at 12:00 am in reply to: LicenseException: A valid q license must be in a known location (e.g. `$QLIC`) to run q code via ‘pykx.q’.Does the import work in unlicensed mode? set QARGS=”–unlicensed”
-
rocuinneagain
MemberAugust 9, 2023 at 12:00 am in reply to: LicenseException: A valid q license must be in a known location (e.g. `$QLIC`) to run q code via ‘pykx.q’.I’ve corrected my link. You specifically need the insights free trial license to get the flags: https://kx.com/kdb-insights-personal-edition-license-download/
-
rocuinneagain
MemberAugust 9, 2023 at 12:00 am in reply to: Calling/using a Python function or Class from QUpdating that link to download with PyKX flags must be done using the insights link specifically: https://kx.com/kdb-insights-personal-edition-license-download/
-
rocuinneagain
MemberAugust 9, 2023 at 12:00 am in reply to: LicenseException: A valid q license must be in a known location (e.g. `$QLIC`) to run q code via ‘pykx.q’.You license will need the flags insights.lib.embedq and insights.lib.pykxto run pykx.q You can check your license flags in q using: q).z.l 4 “insights.lib.embedq insights.lib.pykx insights.lib.sql insights.lib.qlog ins.. If you have an older trial license you simply need to request a new one at: https://kx.com/kdb-personal-edition-download/ https://kx.com/kdb-insights-personal-edition-license-download/ Then replace the old with new on your machine. New licenses come with all the flags enabled. If it is a commercial license then your designated contact can reach out to licadmin@kx.com to have a new license issued: https://code.kx.com/q/learn/licensing/#commercial
-
rocuinneagain
MemberAugust 9, 2023 at 12:00 am in reply to: Calling/using a Python function or Class from QUpdating that link to download with PyKX flags must be done using the insights link specifically:
https://kx.com/kdb-insights-personal-edition-license-download/
-
rocuinneagain
MemberAugust 9, 2023 at 12:00 am in reply to: LicenseException: A valid q license must be in a known location (e.g. `$QLIC`) to run q code via ‘pykx.q’.As well as a licence expiry date each kdb+ licence also has a maintenance update date. licence expiry: You cannot use kdb+ after this date gives exp error maintenance update expiry: You cannot use versions of kdb+ newer than this date. Gives upd error https://code.kx.com/q/basics/errors/#:~:text=format%20not%20recognized-,upd,-Function%20upd%20is .e.g if you have a maintenance expiry date of 2021.12.31 but a licence expiry of 2022.06.01 this means you can use kdb+ up to 2022.06.01 as long as the version of kdb+ was released before 2021.12.31 The dates of your licence are included in the email you got from licadmin@kx.com As of 1.6.0 PyKX is based on 2023.04.17 version of q https://code.kx.com/pykx/1.6/changelog.html#pykx-160 To get a new license with a more open maintenance expiry date your designated contact can reach out to licadmin@kx.com to have a new license issued: https://code.kx.com/q/learn/licensing/#commercial
-
rocuinneagain
MemberJuly 21, 2023 at 12:00 am in reply to: pykx incompatible with subprocess and multiprocess – core dumpsPyKX 1.6.1 has been released. Full details on the release can be found here.
Highlights:- Added
sorted
,grouped
,parted
, andunique
. As methods off ofTables
andVectors
. - Added
PyKXReimport
class to allow subprocesses to reimportPyKX
safely. Details here. - Added environment variables to specify a path to
libpython
. Details here. - Fixed memory leaks in QConnection and PyKX as a server.
- Fixed bug in Jupyter Notebook magic command.
Full details including many other fixes included here.import pykx as kx
with kx.PyKXReimport():
output = subprocess.run(
(str(Path(sys.executable).as_posix()), ‘-c’, ‘import pykx; print(pykx.q(“til 10”))’),
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
text=True,
).stdout.strip()
assert output == “0 1 2 3 4 5 6 7 8 9”
- Added
-
rocuinneagain
MemberJuly 21, 2023 at 12:00 am in reply to: pykx incompatible with subprocess and multiprocess – core dumpsPyKX 1.6.1 has been released. Full details on the release can be found here.Highlights: Added sorted, grouped, parted, and unique. As methods off of Tables and Vectors. Added PyKXReimport class to allow subprocesses to reimport PyKX safely. Details here. Added environment variables to specify a path to libpython. Details here. Fixed memory leaks in QConnection and PyKX as a server. Fixed bug in Jupyter Notebook magic command. Full details including many other fixes included here. import pykx as kx with kx.PyKXReimport(): output = subprocess.run( (str(Path(sys.executable).as_posix()), ‘-c’, ‘import pykx; print(pykx.q(“til 10”))’), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, ).stdout.strip() assert output == “0 1 2 3 4 5 6 7 8 9”
-
Use
::
to skip a levelq)thing:(`procData`!(((`;`$”_source”)!(`;(`a`metadata!1 2;`b`metadata!3 4));`);`);`) q)thing `procData`!((“_source!(`;(`a`metadata!1 2;`b`metadata!3 4));`);`) ` q).[thing;(0;`procData;0;`$”_source”)] `a`metadata!1 2 `b`metadata!3 4 q).[thing;(0;`procData;0;`$”_source”;::;`metadata)] 2 4
https://code.kx.com/q/ref/apply/#nulls-in-i
-
rocuinneagain
MemberJuly 12, 2023 at 12:00 am in reply to: Calling/using a Python function or Class from Qpykx.q
provides this functionality. Most EmbedPy code can be migrated by replacing.p
with.pykx
https://code.kx.com/pykx/1.6/api/pykx_under_q.html
The needed file is included when you
pip install pykx
To make it available to your q processes run the commend to copy the needed files:
python -c "import pykx as kx; kx.install_into_QHOME()"
Then you can use as you describe:
l pykx.q np:.pykx.import`numpy np[`:arange][10]` 0 1 2 3 4 5 6 7 8 9
There are still some improvements needed to reach parity/maturity which will be coming in the next few releases of PyKX.
License flags are needed to use this feature but they are now provided to all downloads.
You can check your license in q
q)`insights.lib.embedq`insights.lib.pykx in: `$" " vs .z.l 4 11b
If you do not have the flags you just need to re download and a new license with the flags will be included.
https://kx.com/kdb-personal-edition-download/https://kx.com/kdb-insights-personal-edition-license-download/
-
Can you run these 2 commands in your command prompt and share the output?
set QARGS="--unlicensed" python -c "import pykx;pykx.util.debug_environment()"
This is the output for me:
**** PyKX information **** pykx.args: ('--unlicensed',) pykx.qhome: C:q pykx.qlic: C:q pykc.licensed: False pykx.__version__: 1.6.0 pykx.file: C:UsersrocuinneagainAppDataLocalPackagesPythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0LocalCachelocal-packagesPython310site-packagespykxutil.py **** Python information **** sys.version: 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)] pandas: 1.5.3 numpy: 1.25.0 pytz: 2022.7.1 which python: C:UsersrocuinneagainAppDataLocalMicrosoftWindowsAppspython.EXE which python3: C:UsersrocuinneagainAppDataLocalMicrosoftWindowsAppspython3.EXE **** Platform information **** platform.platform: Windows-10-10.0.19045-SP0 **** Environment Variables **** IGNORE_QHOME: KEEP_LOCAL_TIMES: PYKX_ALLOCATOR: PYKX_ENABLE_PANDAS_API: PYKX_GC: PYKX_LOAD_PYARROW_UNSAFE: PYKX_MAX_ERROR_LENGTH: PYKX_NOQCE: PYKX_Q_LIB_LOCATION: PYKX_RELEASE_GIL: PYKX_Q_LOCK: QARGS: "--unlicensed" QHOME: C:q QLIC: C:q PYKX_DEFAULT_CONVERSION: SKIP_UNDERQ: UNSET_PYKX_GLOBALS: **** License information **** pykx.qlic directory: True pykx.lic writable: True pykx.qhome lics: ['k4.lic', 'kc.lic'] pykx.qlic lics: ['k4.lic', 'kc.lic'] **** q information **** which q: C:qw64q.EXE q info: (`w64;4f;2023.04.17) "insights.lib.embedq insights.lib.pykx insights.lib.sql insights.lib.qlog insights.lib.kurl insights.lib.objstore insights.lib.bigquery insights.lib.restserver"
Note:
- QLIC must point to the folder containing the licence, it should not point to the the file itself.
- The license needs to have the flags
insights.lib.embedq
insights.lib.pykx
-
The notes on this thread might help: