Forum Replies Created

Page 11 of 22
  • rocuinneagain

    Member
    July 11, 2023 at 12:00 am in reply to: PyKX license error

    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

     

     

  • rocuinneagain

    Member
    July 10, 2023 at 12:00 am in reply to: Running kdb on apple silicon

    The notes on this thread might help:

    Installation for ARM64 – KX Community – 13568

  • rocuinneagain

    Member
    July 3, 2023 at 12:00 am in reply to: OpenSSL 3.0.8 not compatible with PyKX?

    This message is warning about the underlying kurl.q library only.

    PyKX has still imported and will still function (apart from any kurl features)

    If you wish to use kurl then the requirements are listed here:

  • rocuinneagain

    Member
    June 28, 2023 at 12:00 am in reply to: kx.q.sql(‘select * from trades’) command error

    As this ran without error you should now be able to use your query: >>> pykx.q(‘l s.k_’) pykx.Identity(pykx.q(‘::’)) Should now run: kx.q.sql(‘select * from trades’)

  • rocuinneagain

    Member
    June 28, 2023 at 12:00 am in reply to: Storage architecture for KDB

    Some inbuilt functions do make assumptions around how data is stored for segmented databases.

    The functions assume each date is stored in the segment entry matching modulus of the date by the number of par.txt entries .i.e round robin.

    See related thread:

    Solved: .Q.par Doesn’t Provide the Correct Result in the S… – KX Community – 14220

    And warning: https://code.kx.com/q/database/segment/#considerations

    “Partition data correctly: data for a particular date must reside in the partition for that date.”

     

    However for querying and normal operations where these functions are not called there is no such requirement.

     

    Symlinking is used often in kdb+ systems for flexibility around storage layouts.

  • rocuinneagain

    Member
    June 28, 2023 at 12:00 am in reply to: kx.q.sql(‘select * from trades’) command error

    As this ran without error you should now be able to use your query:

    >>> pykx.q('l s.k_') 
    pykx.Identity(pykx.q('::'))

    Should now run:

    kx.q.sql('select * from trades')
  • rocuinneagain

    Member
    June 28, 2023 at 12:00 am in reply to: kx.q.sql(‘select * from trades’) command error

    No it only needs to be done once.

     

    Normally importing PyKX should run it automatically but for some reason your install does not do this.

  • rocuinneagain

    Member
    June 28, 2023 at 12:00 am in reply to: kx.q.sql(‘select * from trades’) command error

    No it only needs to be done once. Normally importing PyKX should run it automatically but for some reason your install does not do this.

  • rocuinneagain

    Member
    June 27, 2023 at 12:00 am in reply to: kx.q.sql(‘select * from trades’) command error

    Can you run:

     

    >>> pykx.q('l s.k_')

     

    If that still fails check

     

    >>> import os 
    >>> os.environ["QHOME"] 
    '/home/user/folder/venv/lib/python3.10/site-packages/pykx/lib' 
    >>> os.listdir(os.environ["QHOME"]) 
    ['write.q', 'm64arm', 'p.q', 'l64arm', 'l64', 'kxic.k', '_update_marker', 'bq.q_', 'csvutil.q', 'kurl.q_', 'q.k', 's.k_', 'w64', 'qlog.q_', 'm64', 'objstor.q_', 'read.q', 'rest.q_', 'kurl.sidecar.q_']

     

    PyKX 1.6.0 includes a utility for inspecting these common areas pykx.util.debug_environment(detailed=True)

  • rocuinneagain

    Member
    June 27, 2023 at 12:00 am in reply to: kx.q.sql(‘select * from trades’) command error

    Can you run: >>> pykx.q(‘l s.k_’) If that still fails check >>> import os >>> os.environ[“QHOME”] ‘/home/user/folder/venv/lib/python3.10/site-packages/pykx/lib’ >>> os.listdir(os.environ[“QHOME”]) [‘write.q’, ‘m64arm’, ‘p.q’, ‘l64arm’, ‘l64’, ‘kxic.k’, ‘_update_marker’, ‘bq.q_’, ‘csvutil.q’, ‘kurl.q_’, ‘q.k’, ‘s.k_’, ‘w64’, ‘qlog.q_’, ‘m64’, ‘objstor.q_’, ‘read.q’, ‘rest.q_’, ‘kurl.sidecar.q_’] PyKX 1.6.0 includes a utility for inspecting these common areas pykx.util.debug_environment(detailed=True)

  • rocuinneagain

    Member
    June 27, 2023 at 12:00 am in reply to: PyKX with Prefect

    I have tested and 1.6.0 will allow the import to continue after this error.

     

    This runs for me:

    from prefect import flow
    from prefect.deployments import Deployment
    import os
    os.environ["QARGS"] = "--unlicensed"
    
    import pykx as kx
    
    def setup():
        print("testing pykx")
        masterConn = kx.SyncQConnection( host='localhost', port=5000, timeout=3.0 )
        user = masterConn('.z.u')
        print('User = ' + user.py())
        port = masterConn('5000')
        print('Port = ' + str(port.py()))
        masterConn.close()
        global conn
        conn = kx.SyncQConnection( host='localhost', port=port.py())
        user = conn('.z.u')
        print('User = ' + user.py())
    
    @flow()
    def test_pykx():
        setup()
        logger = get_run_logger()
        logger.info("Initializing initial arguments")
        dailyDates = conn('dailyDates:(.z.d-7)+til 7')
        logFile = conn('inLogFile:`')
    
    
    def deploy():
        deployment = Deployment.build_from_flow(
            flow=test_pykx,
            name="prefect-example-deployment"
        )
        deployment.apply()
    
    if __name__ == "__main__":
        deploy()

     

    If you want to run in licensed mode you need to move the import of pykx to avoid a nosocket error

    from prefect import flow
    from prefect.deployments import Deployment
    
    def setup():
        import pykx as kx
        print("testing pykx")
        masterConn = kx.SyncQConnection( host='localhost', port=5000, timeout=3.0 )
        user = masterConn('.z.u')
        print('User = ' + user.py())
        port = masterConn('5000')
        print('Port = ' + str(port.py()))
        masterConn.close()
        global conn
        conn = kx.SyncQConnection( host='localhost', port=port.py())
        user = conn('.z.u')
        print('User = ' + user.py())
    
    @flow()
    def test_pykx():
        setup()
        logger = get_run_logger()
        logger.info("Initializing initial arguments")
        dailyDates = conn('dailyDates:(.z.d-7)+til 7')
        logFile = conn('inLogFile:`')
    
    
    def deploy():
        deployment = Deployment.build_from_flow(
            flow=test_pykx,
            name="prefect-example-deployment"
        )
        deployment.apply()
    
    if __name__ == "__main__":
        deploy()

     

     

  • rocuinneagain

    Member
    June 26, 2023 at 12:00 am in reply to: How does (first”) works?

    https://code.kx.com/q/ref/maps/#each

    ' operates the same as each in these cases

     

     

    (first'') dict 
    a| 1 `a 
    b| 2 `b 
    c| 3 `c 
    
    {first each x} each dict 
    a| 1 `a 
    b| 2 `b 
    c| 3 `c 
    
    (first')dict 
    a| 1 
    b| 2 
    c| 3 
    
    first each dict 
    a| 1 
    b| 2 
    c| 3

     

  • Yes there is a warning on: https://code.kx.com/q/database/segment/#considerations

    Partition data correctly: data for a particular date must reside in the partition for that date.

  • rocuinneagain

    Member
    June 23, 2023 at 12:00 am in reply to: kx.q.sql(‘select * from trades’) command error

    To use sql library you will need the correct flag in your license:

    >>> print('n'.join(pykx.q('.z.l 4').py().decode().split())) 
    insights.lib.embedq 
    insights.lib.pykx 
    insights.lib.sql ##<<------ Do you see this? 
    insights.lib.qlog 
    insights.lib.kurl 
    insights.lib.objstore 
    insights.lib.bigquery 
    insights.lib.restserver

     

  • rocuinneagain

    Member
    June 23, 2023 at 12:00 am in reply to: kx.q.sql(‘select * from trades’) command error

    To use sql library you will need the correct flag in your license: >>> print(‘n’.join(pykx.q(‘.z.l 4’).py().decode().split())) insights.lib.embedq insights.lib.pykx insights.lib.sql ##<<—— Do you see this? insights.lib.qlog insights.lib.kurl insights.lib.objstore insights.lib.bigquery insights.lib.restserver

Page 11 of 22