Saravanan666/pypi-org huggingface dataset:
Package: querio
Quer.ioDocumentation linksSeeDocumentationfor DocumentationSeeUsage guidefor a basic rundown on how to use Quer.ioSeeDatabase Schema 1for single table sample database schemaSeeDatabase Schema 2for normalized sample database schemaSeeML documentationfor documentation
on the machine learning modelProject descriptionThis project is built to the specifications and requirements provided by Prof. Michael Mathioudakis and is a course work project for course TKT20007 Software Engineering Lab at the University of Helsinki, department of Computer Science.The aim of this project is to build an Approximate Query Processing (AQP) engine -- i.e., a software layer on top of a relational database, that allows us to obtain fast, approximate answers to aggregate queries, with the help of Machine Learning models.Chosen implementation is a Python library that can be used with multiple different database systems. Machine learning components are built using Scikit Learn.InstallationThis project is done with Python 3.6SeeDatabase Installation guidefor information how to install the sample databases this application was tested on.SeeApplication Installation guidefor information how to install the application and all its dependencies.Optional installationSeeQuerio Schedulerfor how to install and use a scheduler for periodical model retraining.TestsCurrently the project contains tests that are done using theunittestlibrary. Tests can be run with the following command from the project rootpython3 -m unittest discoverThis command will find every test from the project and run it. If you want to run an individual test script it can be done with the following commandpython3 -m unittest [path to file]ContributorsDennis AhlforsJoonas JKim ToivonenMauri FrestadiusOssi RäisäPetja Valkama
Package: querius
Querius ClientClient code for interacting with theQueriusAPI.InstallpipinstallqueriusUsagefromgoogle.cloudimportbigqueryfromqueriusimportQueriusClient,patch_bq_client_with_querius_clientfrompathlibimportPathbq_client=bigquery.Client()q_client=QueriusClient.from_service_account_path(api_url="<querius-url>",service_account_path=Path('path/to/key.json'),customer_id="<querius-customer-id>",timeout_seconds=2)patch_bq_client_with_querius_client(bq_client,q_client)
Package: querpyable
QuerpyableA Python implementation of LINQ:bulb: ExampleCalculating the first 10000 primesQueryable\.range(2,1_000_000)\.where(lambdan:all(n%i!=0foriinrange(2,int(n**0.5)+1)))\.take(10000):cd: InstallationpipinstallquerpyableIn order to locally set up the project please follow the instructions below:# Set up the GitHub repositorygitinit
gitconfig--localuser.nameVasilisSioros
gitconfig--localuser.emailbillsioros97@gmail.com
gitadd.
gitcommit-m"feat: initial commit"gitremoteaddoriginhttps://github.com/billsioros/querpyable# Create a virtual environment using poetry and install the required dependenciespoetryshell
poetryinstall# Install pre-commit hookspre-commitinstall--install-hooks:book: DocumentationThe project's documentation can be foundhere.:heart: Support the projectFeel free toBuy me a coffee! ☕.:sparkles: ContributingIf you would like to contribute to the project, please go through theContributing Guidelinesfirst.:label: CreditsThis project was generated withbillsioros/cookiecutter-pypackagecookiecutter template.
Package: query
queryis a simple module for quickly, interactively exploring a SQL
database. Together with IPython, it supports quick tab-completion of table
and column names, convenience methods for quickly looking at data (e.g.,.head(),.tail()), and the ability to get a rich interactive database
connection up in only 2 lines by setting a few required environmental
variables.Demo in 2 linesExplore the included demo database:fromqueryimportQueryDbdb=QueryDb(demo=True)Real-world use case in 2 linesOr set a few environmental variables (QUERY_DB_DRIVER,QUERY_DB_HOST,QUERY_DB_PORT,QUERY_DB_NAME, andQUERY_DB_PASS) and get started just as quickly:fromqueryimportQueryDB# capital 'B' is OK too :)db=QueryDB()Interactive exampleLinksCode and additional details on Github:
Package: queryable-list
python-queryable-listForget classical list filtering and enjoy yourself by generating flexible and
fluent list queries with QueryableList.What is the purpose?List filtering sometimes may be difficult and boring especially when you
need to apply consecutive filters. This library is inspired by flexibility
of Django ORM and LinQ. I also believe it looks more readable to write
all filters in the same context.Let's assume we have a list named numbers that contains duplicated numbers,
and we need to use a filter that is so:max(list(set(filter(lambdax:x>20,numbers)))[11:])Maybe you think I exaggerated but real life problems can even be more confusing.Let's assume the number is a QueryableList.
The above filter can be rewritten readable such that with QueryableList:numbers.filter(lambdax:x>20).distinct().skip(11).max()Also your queries will be reusable because QueryableList works lazy:persons=[{'first_name':'John','last_name':'Doe','age':22},{'first_name':'John','last_name':'Smith','age':33},...]query=QueryableList(persons).select('last_name','age')query2=query.select_list('age',flat=True)query3=query.select_list('last_name')print(list(query))print(list(query2))print(list(query3))# Outputs# [{'last_name': 'Doe', 'age': 22}, {'last_name': 'Smith', 'age': 33}]# [22, 33]# [['Doe'], ['Smith']]All the queries don't work in their building step as you can see . They
worked at the time they were called via list(). In this wayquerycould
be used to buildquery2andquery3queries.Which Python versions are supported?Python 2.7 and Python 3.5+ versions are supported. A lot of unit tests are
written to consider all the cases on different Python versions.Installationpipinstallqueryable-listRunning TestsRun this command by using your virtual environment.python-munittestdiscover
Package: query-blockchain-state-lib
Query Blockchain State LibThis repo is inherited fromQueryStateLibInstallpip3 install query-blockchain-state-libExample do query state batch at clientExample usedGithub :https://github.com/Centic-io/query-blockchain-state-libUseEthereum Json-pcBaseUse Ethereum JSON-RPC call to interact with EVM node providerPostman usage:Link
Package: querybuilder
For the following Table example:CREATETABLEarticle(idintegerNOTNULL,createdtimestampwithouttimezoneNOTNULL,titlecharactervarying(255)NOTNULL,type_idintegerNOTNULL,topic_idintegerNOTNULL,author_idsinteger[]NOTNULL,category_idsinteger[],tagscharactervarying(255)[],keywordscharactervarying(255)[],summarytext,contenttextNOTNULL,coverjsonbNOTNULL,editors_pickbooleanNOTNULL,pageviewsbigintNOTNULL,updatedtimestampwithouttimezoneNOTNULL,publishedtimestampwithouttimezone,permalinkcharactervarying(255),cust_metajsonb);SpecificationsFor all articles withtype_idequal to1(type_id = 1):json    {   "EQ": {      "type_id": 1   }    }Same structure is
for:ConditionJSON KEYSymbolJSON QueryLess thanLT<{"LT": {"type_id": 2}}Less than or Equal toLE<={"LE": {"type_id": 2}}Greater thanGT>{"GT": {"type_id": 2}}Greater than or Equal toGE>={"GE": {"type_id": 2}}Not equalNE!={"NE": {"type_id": 2}}INFor all articles wheretype_idis in[1, 2, 3], the JSON query
will be:{"IN":{"pageviews":[1,2,3]}}BETWEENFor all articles withpageviewsbetween 10000 and 15000, the JSON
query will be:{"BETWEEN":{"pageviews":[10000,15000]}}CONTAINS_ANYFor all articles whereauthor_idscontains any of8, 9, 10, the
JSON query will be:{"CONTAINS_ANY":{"author_ids":[8,9,10]}}CONTAINS_ALLFor all articles whereauthor_idscontains all of8, 9, the JSON
query will be:{"CONTAINS_ALL":{"author_ids":[8,9]}}STARTSWITHFor all articles wheretitlestarts withFilm Review, the
JSON query will be:{"STARTSWITH":{"title":"Film Review"}}Complex QueriesComplex queryies can contain nested structures ofORorANDor both.For all articles withpageviewsbetween 10000 and 15000 and whoseauthor_idscontains8(the author’s ID) (in above schema,author_idsis an ArrayField in Postgres), the JSON query will be:{"AND":[{"BETWEEN":{"pageviews":[10000,15000]}},{"CONTAINS":{"author_ids":[8]}}]}RequirementsIf there is only one condition, likepageviews> 100, the query
can directly contain outermost key as one ofEQ, NE, GT, GE, LT, LE, STARTSWITH, CONTAINS, CONTAINS_ALL, CONTAINS_ANY, BETWEEN.example:{"STARTSWITH":{"title":"Film Review"}}But if there are more conditions involved, the outermost key must be
one of `OR
Package: query-cli
# queryThis is a simple, yet powerful command line translator with baidu translate命令行下翻译工具，翻译服务基于百度翻译https://github.com/yangyang-zhang/query## install 安装pip install query-cli## Usage 用法### English To Chinese（英文翻译中文）```query apple******************************apple:苹果*****************************```### Chinese To English（中文翻译英文）```query -t en 苹果******************************苹果:Apple*****************************```> 目标翻译语言支持英语、日语、德语等几十种语言，用 -t 指定翻译目标语言即可### Chinese To Japan（中文翻译日文）```query -t jp 我是谁******************************我是谁:私は誰ですか*****************************```## query 作为一个模块导入>默认翻译为中文,第二个参数为翻译目标语言```>>> from query import Query>>> q = Query('apple')>>> q.translate()apple:苹果{'src_result': 'apple', 'trans_result': '苹果'}>>> q = Query('english', 'wyw')>>> q.translate()english:英吉利语{'src_result': 'english', 'trans_result': '英吉利语'}```
Package: query-client
Query ClientThis is a simple client to query.example初始化客户端及元数据fromquery_clientimportQueryClientqc=QueryClient()tables=qc.get_meta()# print(tables) 获取全部可查表,及其coloumns, 元数据## 目前只有两个相关表注册can_table=tables["can_detail"]pcd_table=tables["pcd_label_desc"]fetchpythonfromsqlalchemy.sql.expressionimportselect,text,and_fromquery_clientimportQueryClientimportpandasaspdqc=QueryClient()tables=qc.get_meta()mytable=tables["pcd_label_desc"]# 1. fetch_by_stmt 初始化 statement, select/where/group_bystmt=select(mytable.c.dataset,mytable.c.batch_path,text("array_distinct(categories) scenes"),text("cardinality(filter(categories, x -> x IN ('car'))) as target_cnt"))r=qc.fetch_by_stmt(stmt)df=pd.DataFrame(r)# 2. fetch_by_sqlquery="select * from pcd_label_desc limit 10"r=qc.fetch_by_sql(query)df=pd.DataFrame(r)具体示例城区场景的筛选定义单帧指标(各种目标数)group by 序列fetch_by_sql 实现方式cte 语法:t 表查询单帧的去重场景、不同类型的目标数指标，dataset 及batch 维度利用 t 表的dataset, batch_path 维度聚合指标code examplequery="""WITH t AS (SELECTdataset,batch_path,array_distinct(categories) scenes,cardinality(filter(categories,x -> x IN ('car','van','truck','mini_truck','special_truck','truck','cyclist','bicycle','pedestrian'))) AS target_cnt,cardinality(filter(categories,x -> x IN ('truck','mini_truck','special_truck'))) truck_cnt,cardinality(filter(categories, x -> x IN ('car', 'van'))) carvan_cnt,cardinality(filter(categories, x -> x = 'pedestrian')) pedestrian_cnt,cardinality(filter(categories, x -> x IN ('cyclist', 'bicycle'))) cyclist_cntFROMpcd_label_descWHEREdelivery_date = '20230310'AND any_match(road_condition,x -> x = 'highway_road'))SELECTdataset,batch_path,array_distinct(FLATTEN(ARRAY_AGG(scenes))) scenes,SUM(target_cnt) target_cnt,SUM(carvan_cnt) carvan_cnt,SUM(pedestrian_cnt) pedestrian_cnt,SUM(truck_cnt) truck_cnt,SUM(cyclist_cnt) cyclist_cntFROMtGROUP BY1,2ORDER BYtarget_cnt DESC"""r=qc.fetch_by_sql(query)df=pd.DataFrame(r)fetch_by_stmt 实现方式mytable=tables["pcd_label_desc"]stmt=select(mytable.c.dataset,mytable.c.batch_path,# 指定table聚合的维度text("cardinality(filter(categories, x -> x IN ('car', 'van'))) carvan_cnt"),# 定义函数变换指标# ... goon).where(and_(mytable.c.delivery_date=="20230310",text("any_match(road_condition, x -> x = 'city_road')")# 过滤城区场景))# 指标cte 表cte=qc.with_cte(stmt)# 继续聚合stmt2=select(cte.c.dataset,cte.c.batch_path,text("SUM(carvan_cnt) carvan_cnt")).group_by(cte.c.dataset,cte.c.batch_path)# 查询结果r=qc.fetch_by_stmt(stmt2)df=pd.DataFrame(r)
Package: query-client-silverbullet-s
GTA SA-MP clientRCON and query client library for  PythonA modern Python library for querying and managing SA-MP servers.Supported Python version 2.7, 3.4, 3.5 and 3.6Installationpipinstallsamp-client-esUsageThe library can be easily interfaced using a singleSampClientclass:fromsamp_client.clientimportSampClientwithSampClient(address='localhost',port=7777)asclient:printclient.get_server_info()The library also allows you to run RCON commands as well as queries:fromsamp_client.clientimportSampClientwithSampClient(address='localhost',port=7777,rcon_password='password')asclient:client.rcon_cmdlist()Query and RCON responses are parsed into native Python structures:fromsamp_client.clientimportSampClientwithSampClient(address='localhost',port=7777,rcon_password='password')asclient:info=client.get_server_info()printinfo# ServerInfo(password=True, players=9, max_players=100, hostname='Convoy Trucking', gamemode='Convoy Trucking 3.1.1', language='English')printinfo.gamemode# 'Convoy Trucking 3.1.1'printclient.rcon_get_hostname()# ServerVar(name='hostname', value='Convoy Trucking', read_only=False)printclient.rcon_players()[0].ping# 26ExamplesFolderexample/contains usage example of the libraryRunning testsTo run tests:python-munittestdiscover-v
Package: querycolumns
querycolumnSimple extension toPandasthat makes it easier to select columns in (very)wideDataFrames. If you name your columns in a hierarchical fashion with a separator (e.g, as you might get frompd.normalize_json(), it lets you select a column or group of columns easily and with tab completion.Here's a quick demo of what this looks like.>>> import pandas as pd
    >>> from querycolumn import patch_dataframe_with_query_columns
    >>> patch_dataframe_with_query_columns()
    >>> df = pd.DataFrame([{'person.size.height': 3, 'person.size.weight': 4}])
    >>> df.qc.person
    <QueryColumns @ person: size>
    >>> df.qc.person.size
    <QueryColumns @ person.size: height, weight>
    >>> df.qc.person.size.weight
    0    4
    Name: person.size.weight, dtype: int64
    >>> df[df.qc.person.size]
    >>>QueryColumns does its magic by patching aDescriptorinto theDataFrameclass. When you retrieve the attributeqcfrom a frame, `QueryColumns.get()' is invoked; this is when QueryColumns introspects its parent dataframe and returns a magical object with tab completion for segmented column names.Note I wrote QueryColumns after working with Pandas for about a week. I don't know if it encourages elegant use of the library, but I find it useful for my usecase. I'm practically certain that it doesn't extend Pandas as one should (there areexplicitAPIs for that), but I couldn't think of a way to do it without the Descritor protocol.
Package: querycontacts
querycontacts - Query Abuse ContactsInstallationpip install querycontactsStarting with version 2.0.0 support for python 2.7 is dropped. This is related to dnspython 2.0.0 also dropping support.Command line usageusage: querycontacts [-h] [--provider PROVIDER] [--version] ip

QueryContact - Find the Abuse contact for a IP address

positional arguments:
ip                   query network abuse contacts for a given ip address

optional arguments:
-h, --help           show this help message and exit
--provider PROVIDER  change standard network abuse contacts provider.
                    Defaults to abuse-contacts.abusix.zone
--version            show program's version number and exitExamplesShow version:$ querycontacts --version
querycontacts 2.0.0Show abuse contact for your IP:$ IP=$(curl ipecho.net/plain)
$ querycontacts $IP
abuse@yourisp.example.comTest response for localhost:$ querycontacts 127.0.0.1
Abusix ContactDB Test pointLibrary usage>>> from querycontacts import ContactFinder
>>> qf = ContactFinder()
>>> qf.find('127.0.0.2')
['root@localhost', 'abuse@localhost']

>>> qf.find('::ffff:7f00:2')
['root@localhost']
Package: query-counter
QueryCounterSQLAlchemy model N+1 debugger.NOTE: This is a debugging tool that is not meant to be deployed in production.AboutThis module will help identify N+1 DB calls made through SQLAlchemy. It takes advantage of the SQLAlchemy event listener fordo_orm_execute.QueryCounter will provide insights into which model DB calls are made multiple times, with optional tracebacks and heuristics to determine where these calls originate.By default, QueryCounter will log results with an optional config to raise an Exception.Installationpipinstallquery-counterUsageUsage: Create QueryCounter with a SQLalchemy session, an optional config, andinitializewhen you would like to start tracking requests:fromquery_counterimportQueryCounterquery_counter=QueryCounter(session=session)query_counter.initialize()Runanalyzeto dig into queries that ran since initialization:query_counter.analyze()This also works as a context manager:withQueryCounter(session=session,config=QueryAnalysisConfig(alert_threshold=0))ascounter:session.query(User).first()counter.analyze()Setting a breakpoint in the analyze function will allow you to inspect
all of the queries and their stack traces.ConfigurationQueryCounteraccepts an optionalconfigkwarg of typeQueryAnalysisConfig.QueryAnalysisConfigis a dataclass with the following specifications/defaults:# QueryCounter analyze will not log or raise exceptions if the number# of duplicated DB calls is less than the alert_thresholdalert_threshold:int=10# QueryCounter analyze will raise an exception if Trueraise_if_exceeds:bool=False# QueryCounter analyze will info log if no DB calls# exceed the thresholdlog_no_alert:bool=False# QueryCounter will store the stacktrace relevant to the DB calltraceback_enabled:bool=False# QueryInstance will inspect frames and filter the stack down# to codepaths specified in heuristic_pathsheuristics_enabled:bool=False# Requires heuristics_enabled=True - filters stack down to# these codepathsheuristic_paths:list=field(default_factory=list)TODOLintingTestsPipelineLicenseQueryCounter is distributed under the MIT License.
Package: queryeasy
queryeasyExecute SQL queries on data present in CSV or Excel files. Also allows to generate the query output files.FeaturesQuery the CSV or Excel files using sql queriesProvides the option to store the query output to .xls, .xlsx, .csv formatsFormats the output to fit in the terminalRemoves the spaces from the column headers to ease query processSaves the output file to default dir if no path is specifiedInstallationYou can pip install the package usingpipinstallqueryeasyThe command line utility will be installed as
queryeasy to bin on Linux (e.g. /usr/bin); or as
queryeasy.exe to Scripts in your Python installation on Windows
(e.g. C:\Python3\Scripts\tabulate.exe).After installing, check the versionqueryeasy--versionUsagequeryeasy [-h] [-s sheet_name] [-o output_file] [-v] filename sql_queryIt can be used to execute sql queries on csv filequeryeasysample.csv"select * from sample"It can be used to execute sql queries on excel filequeryeasysample.xls"select * from sample"-sSheet1
queryeasysample.xlsx"select * from sample"-sSheet3The output of the performed query can be saved to a csv or excel filequeryeasysample.xls"select * from sample"-sSheet1-o/path/output.xls
queryeasysample.xlsx"select * from sample"-sSheet3-o/path/output.xlsx
queryeasysample.xlsx"select * from sample"-sSheet3-ooutput.xlsx
queryeasysample.csv"select * from sample"-sSheet3-o/path/output.csv
queryeasysample.csv"select * from sample"-sSheet3-ooutputArgumentspositional arguments: 
  filename              Enter the file path/name
  sql_query             Enter the SQL query

optional arguments:
  -h, --help            show this help message and exit
  -s sheet_name, --sheet sheet_name
                        Provide the sheet name for excel file
  -o output_file, --output output_file
                        Output file path/name to store results
  -v, --version         show program's version number and exitNotesTable names used in the SQL query should match the input CSV/Excel file names,
without the ".csv" or ".xls" extensionWhile entering query, replace the spaces in column names with underscore(_)The default output file extension is .csvThe output file supports ".xlsx", ".xls", ".csv" extensions as of nowContributeThe library is in initial stage and requires a lot of work, please feel free to contribute
Package: query-ec2-metadata
EC2 Instance MetadataThis allows querying EC2 instance metadata.It uses IMDSv2. Session credentials are NOT available using this.InstallationAvailable on Pypi asquery-ec2-metadatapip install query-ec2-metadataCommand line toolsec2-metadataUsage:ec2-metadata KEYThis returns an attribute from the instance metadata.The KEY can be any of the data values fromhttps://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-categories.htmlinstance-identityUsage:instance-identity KEYThis returns an attribute from the instance identity document.The key can be any of the data values fromhttps://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-identity-documents.htmlPython moduleinstance_identity_document() -> Dict[str, str]:This returns the identity document for the instance.instance_identity(key: str) -> str:This returns an attribute from the instance identity document.The key can be any of the data values fromhttps://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-identity-documents.htmlec2_metadata(key: str) -> str:This returns an attribute from the instance metadata.The key can be any of the data values fromhttps://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-categories.htmlDevelopmentmake initto set things upmake pytestto run unit testsmake testto run all testsRemember to bump the version inpyproject.tomlbefore merging.
Package: query-everywhere
Query Everywherequery your data in every RDBMS.Installpipinstallquery-everywhereNoticesYou should install your db driver(likepsycopg2-binary) before use.Examplefromquery_everywhereimportQueryer# Create a Queryer with DSNdsn="sqlite:///db.sqlite3"queryer=Queryer(dsn)# Queryfilters=[("name__contains","part of name"),("age__gte",20),("age__lt",30),("address__neq","beijing"),("address__eq","shanghai"),("address__icontains","beijing"),]order="create_time desc"limit=10offset=0data=queryer.query("people",filters,order,limit,offset)print(data)# It where do# SELECT * FROM "people" WHERE name LIKE ? AND age >= ? AND age < ?# AND address != ? AND address = ? AND LOWER(address) LIKE ? ORDER BY ? LIMIT ? OFFSET ?Supported operatorsOperatorCommenteqequal toneqnot equal tonenot equal toltless thangtgreater thanlteless than or equal togtegreater than or equal tostartswithstarts with the given valueendswithends with the given valuecontainscontains the given valueicontainscontains the given value in the case-insensitive wayisnullis null
Package: query-factory
QUERY FACTORYThis tool should help organizing SQL queries into python projects.USAGEYou should seperate query template in a yaml file as in the following example:# template.yamldescription:|This is a simple query for demonstration purpose.variables:start_date:description:UTC datetime string to gather data from (inclusive)required:trueend_date:description:UTC datetime string to gather data to (exclusive)required:truecategory_id:description:Category id to filter on. If null, filter won't apply.required:falsedefault:nullmarket:description:Market scope (either 'pro' or 'part').required:falsedefault:partquery_template:|SELECT *FROM db.tableWHERE event_date >= {{ start_date }}AND event_date < {{ end_date }}AND market = {{ market }}{% if category_id %}AND category_id = {{ category_id }}{% endif %}LIMIT = 100;Then get your factory up and run some queries:fromquery_factoryimportSQLQueryFactory# factory setup.factory=SQLQueryFactory("/path/to/template.yaml")Factory carries some information about template as:>>>set(factory.required_variables){'end_date','start_date'}>>>set(factory.optional_variables){'category_id'}>>>factory.describe("start_date")'UTC datetime string to gather data from (inclusive)'Here is how you can variabilize your queries using a factory as define above:importpandasaspdconnection=connect_to_sql_query_engine()data_2020_02_01=pd.read_sql(factory(start_date="2020-02-01",end_date="2020-02-02"),con=connection)data_2020_02_02_filtered_on_categ1=pd.read_sql(factory(start_date="2020-02-02",end_date="2020-02-03",category_id="categ_1"),con=connection)