PageSourceSearch

https://www.mistql.com/assets/js/39660057.8a69f662.js

js mistql.com collected 2026-10-07 02:06:56 UTC 5,978 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkmistql_docs=self.webpackChunkmistql_docs||[]).push([[5955],{4587:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>c,default:()=>h,frontMatter:()=>d,metadata:()=>s,toc:()=>o});const s=JSON.parse('{"id":"reference/implementations/py","title":"Python Implementation","description":"The Python implementation of MistQL can be installed via pip install mistql.","source":"@site/versioned_docs/version-0.4.7/reference/implementations/py.md","sourceDirName":"reference/implementations","slug":"/reference/implementations/py","permalink":"/docs/0.4.7/reference/implementations/py","draft":false,"unlisted":false,"editUrl":"https://github.com/evinism/mistql/edit/docs/versioned_docs/version-0.4.7/reference/implementations/py.md","tags":[],"version":"0.4.7","sidebarPosition":2,"frontMatter":{"sidebar_position":2},"sidebar":"tutorialSidebar","previous":{"title":"JS Implementation","permalink":"/docs/0.4.7/reference/implementations/js"}}');var r=t(4848),i=t(8453);const d={sidebar_position:2},c="Python Implementation",l={},o=[{value:"Example Usage:",id:"example-usage",level:3},{value:"<code>mistql</code> package exports",id:"mistql-package-exports",level:3},{value:"Type correspondence between Python and MistQL",id:"type-correspondence-between-python-and-mistql",level:3}];function a(e){const n={code:"code",h1:"h1",h3:"h3",header:"header",p:"p",pre:"pre",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.header,{children:(0,r.jsx)(n.h1,{id:"python-implementation",children:"Python Implementation"})}),"\n",(0,r.jsxs)(n.p,{children:["The Python implementation of MistQL can be installed via ",(0,r.jsx)(n.code,{children:"pip install mistql"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"example-usage",children:"Example Usage:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-py",children:"import mistql\n\nlength = mistql.query('count @', [1, 2, 3])\nprint(length)\n"})}),"\n",(0,r.jsxs)(n.h3,{id:"mistql-package-exports",children:[(0,r.jsx)(n.code,{children:"mistql"})," package exports"]}),"\n",(0,r.jsxs)(n.table,{children:[(0,r.jsx)(n.thead,{children:(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.th,{children:"Export"}),(0,r.jsx)(n.th,{children:"type"}),(0,r.jsx)(n.th,{children:"Description"})]})}),(0,r.jsxs)(n.tbody,{children:[(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"query"})}),(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"(query: string, data: any) => any"})}),(0,r.jsx)(n.td,{children:"The query interface for MistQL"})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"__version__"})}),(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"str"})}),(0,r.jsx)(n.td,{children:"The current version of MistQL installed"})]})]})]}),"\n",(0,r.jsx)(n.h3,{id:"type-correspondence-between-python-and-mistql",children:"Type correspondence between Python and MistQL"}),"\n",(0,r.jsxs)(n.p,{children:["Separate from the specification of the language, the python implementation maps from\nPython types to MistQL types in a specific manner, as documented by the table below. As\nthe following is NOT part of the language, rather the library, the correspondence\nmay change with further releases of the ",(0,r.jsx)(n.code,{children:"mistql"})," package, following semver."]}),"\n",(0,r.jsx)(n.p,{children:"Note that this is generally very restrictive in what it allows, but\ncan be easily expanded as necessary. For examples, iterables as a whole may, outside of\nspecific cases, be casted directly to MistQL array types."}),"\n",(0,r.jsx)(n.p,{children:"If this correspondence doesn't work for you for some reason, please open an issue and\ndescribe the situation carefully. This correspondence is easier to change than the language\nitself."}),"\n",(0,r.jsxs)(n.table,{children:[(0,r.jsx)(n.thead,{children:(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.th,{children:"Value"}),(0,r.jsx)(n.th,{children:"MistQL Value"})]})}),(0,r.jsxs)(n.tbody,{children:[(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"number"})}),(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"double"})})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"boolean"})}),(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"boolean"})})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"string"})}),(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"string"})})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"dict"})}),(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"object"})})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"None"})}),(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"null"})})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"list"})}),(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"array"})})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"tuple"})}),(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"array"})})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"Date"})}),(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"date.toISOString()"})})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:"Anything else"}),(0,r.jsx)(n.td,{children:"Error"})]})]})]})]})}function h(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(a,{...e})}):a(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>d,x:()=>c});var s=t(6540);const r={},i=s.createContext(r);function d(e){const n=s.useContext(i);return s.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:d(e.components),s.createElement(i.Provider,{value:n},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.