Saravanan666/pypi-org huggingface dataset:
Package: pgextrascli
Simple command line wrapper forhttps://github.com/scottwoodall/python-pgextrasFree software: BSD licenseUsageUsage: pgextrascli [OPTIONS] CMDOptions:$ pgextrascli --help

-l, --list-commands  shows available commands
--host=HOST          database host, default: localhost
--port=PORT          database port, default: 5432
--dbname=DBNAME      database name, default: template1
--user=USER          database user, default: postgres
--password=PASSWORD  database password, default: empty
--help               Show this message and exit.Available commands:$ pgextrascli -l

bloat                          Table and index bloat in your database ordered by most wasteful.
blocking                       Queries holding locks other queryes are qaiting to be releases
cache_hit                      Calculates your cache hit rate (effective databases are at 99% and up).
calls                          Show 10 most frequently called queries. Requires the pg_stat_statements.
index_usage                    Calculates your index hit rate (effective databases are at 99% and up).
locks                          Display queries with active locks.
long_running_queries           Show all queries longer than five minutes by descending duration.
outliers                       Show 10 queries that have longest execution time in aggregate. Requires the pg_stat_statments.
ps                             View active queries with execution time.
seq_scans                      Show the count of sequential scans by table descending by order.
total_table_size               Show the size of the tables (including indexes), descending by size.
unused_indexes                 Show unused and almost unused indexes, ordered by their size relative to the number of index scans.
vacuum_stats                   Show dead rows and whether an automatic vacuum is expected to be triggered.
version                        Get the Postgres server version.
Package: pg-facile
pg-facileAn easy-to-use wrapper for psycopg2 for those who only care to type a SQL statement and get its result with column names in an easy to use format (namely: students).DisclaimerThis package is used within a Web Services course where students do not have much time to learn and practice the proper way of accessing databases in Python:https://www.python.org/dev/peps/pep-0249/Indeed, databases are not the core of the course; the architecture is what matters most and students are quickly encouraged to use ORM libraries such asSQLAlchemyover typing their own SQL statements.Please refrain from using this package. It is merely a small wrapper aroundpsycopg2(link).Getting StartedThe following instructions illustrate how to use this package.PrerequisitesIdeally you should have installed thevirtualenvcommand and Python 3.Also, you will need access to a postgresql database. You should know how to describe the host and credentials in URL form; such aspostgres://[user[:password]@][netloc][:port][/dbname].If you have Docker installed, then you may rundocker run -p 5432:5432 -e POSTGRES_PASSWORD=123456 --rm -d postgresto start a local server whose URL will be:postgres://postgres:123456@localhost:5432/postgres.InstallingUsingpip:pip install pg-facileIdeally this should be preceded by the creation and activation of a virtual environment:virtualenv -p python3 venv
source venv/bin/activateExampleHere is an example using thepg-facilemodule:frompg-facileimportDatabaseurl='postgres://postgres:123456@localhost:5432/postgres'withDatabase(url)asdb:db.execute('CREATE TABLE numbers (value INTEGER)')foriinrange(50):db.execute('INSERT INTO numbers(value) VALUES (:val)',{'val':i})withDatabase(url)asdb:rows=db.executeAndFetchAll('SELECT * FROM numbers WHERE value % 2 = 0')forrowinrows:print(row)ContributingNo contributions are expected nor wanted. Yet, if you find a bug or which to enhance this humble package, you may:contact the maintainer by email <pierre.grabolosa@imerir.com>open an issue on the GitHub project repository,submit a pull request.VersioningWe useSemVerfor versioning. For the versions available, see thetags on this repository.AuthorsSee the list ofcontributorswho participated in this project.LicenseThis project is licensed under the MIT License - see theLICENSEfile for details
Package: pgflux
pgfluxpgfluxis a Python utility to send PostgreSQL metrics to InfluxDB. The
drivers when developing this tool were:Make it easy to extend:Authoring new queries shouldonlyrequire
PostgreSQL knowledge to allow non-devs to easily add/fix/modify the collected
metrics.pgfluxdoes not require you to know Python, InfluxDB nor Grafana
to work on the provided SQL queries.Be independently runnable:pgfluxshould be runnable without first
setting up a hugely complex dev-environment. All that is needed is a Python
environment and a PostgreSQL server (a Dockerfile for testing is supplied for
the latter).ScreenshotsIt enables Grafana visualisations as seen in the screenshots below:InstallationThe project can be installed directly viapip:python3 -m venv /path/to/virtual-env
/path/to/virtual-env/bin/pip install pgfluxThe use of a virtual environment is optional, but recommended.UsageSeehttps://post-luxembourg.github.io/pgflux/usage.htmlDevelopment & ExtendingFor detailed instructions, seehttps://post-luxembourg.github.io/pgflux/development.htmlNOTEThis project usesfabricas task runner (seehttps://fabfile.org). To
install it use eitherpipx install fabric(recommended) or, if you don’t
havepipx:pip install--userfabric.CommandsListing all available development tasks:fab -lTo set up or refresh the development environment:fab developRun PostgreSQL, InfluxDB & Grafana containers (requiresdocker-compose):fab run-dev-containersRun the tests:fab test
Package: pg-force-execute
pg-force-executeContext manager to run PostgreSQL queries with SQLAlchemy, terminating any other clients that continue to block it after a configurable delay.Using this to wrap queries is somewhat of a last resort, but is useful in certain Extract Transform Load (ETL) pipeline contexts. For example, if it is more important to replace one table with another than to allow running queries on the table to complete, then this can be used to run the relevantALTER TABLE RENAME TOquery.Installationpg-force-executecan be installed from PyPI using pip.psycopg2orpsycopg(Psycopg 3) must also be explicitly installed.pipinstallpg-force-executepsycopgExample usageimportdatetimeimportsqlalchemyassafrompg_force_executeimportpg_force_execute# Run postgresql locally should allow the below to run# docker run --rm -it -e POSTGRES_HOST_AUTH_METHOD=trust -p 5432:5432 postgresengine=sa.create_engine('postgresql+psycopg://postgres@127.0.0.1:5432/')query='SELECT 1'# A more realistic example would be something that needs an exclusive lock on a tablewith\engine.begin()asconn,\pg_force_execute(conn,# SQLAlchemy connection to run the querydelay=datetime.timedelta(minutes=5),# Amount of time to wait before cancelling queries):results=conn.execute(sa.text(query))print(results.fetchall())APIThe API a single context managerpg_force_execute.pg_force_execute(conn, delay=datetime.timedelta(minutes=5), check_interval=datetime.timedelta(seconds=1), cleanup_timeout=datetime.timedelta(seconds=10), logger=logging.getLogger("pg_force_execute"))conn- ASQLAlchemy connectionthat will be unblockeddelay(optional) - How long to wait before attempting to terminate backends blockingconncheck_interval(optional) - The interval between repeated attempts to terminate backends blockingconncleanup_timeout(optional) - How long to wait for resources to be cleaned up before allowing exit of the context managerFor usual operation this parameter shouldn't need to be changed.logger(optional) The Python logger instance through which to logCompatibilityPython >= 3.7.1 (tested on 3.7.1, 3.8.0, 3.9.0, 3.10.0, and 3.11.0)psycopg2 >= 2.9.2 or Psycopg 3 >= 3.1.4SQLAlchemy >= 1.4.24 (tested on 1.4.24 and 2.0.0)PostgreSQL >= 9.6 (tested on 9.6, 10.0, 11.0, 12.0, 13.0, 14.0, and 15.0)Note that SQLAlchemy < 2 does not support Psycopg 3.Running tests locallypython-mpipinstall-e".[dev]"# Only needed once./start-services.sh# Only needed oncepytest
Package: pgfutil
TITLEGenerated fromthe Pimoroni Python Boilerplate.Stable library from PyPi:Just runpip3 install pgfutilIn some cases you may need to usesudoor install pip with:sudo apt install python3-pipLatest/development library from GitHub:git clone https://github.com/gadgetoid/pgfutilcd pgfutilpip3 install .Changelog0.0.1Initial Release
Package: pggm-datalab-utils
Datalab utilsWell-specified utilities from the Datalab of PGGM. Our aim with this package is to provide some tooling to make our lives a bit easier.
So far the package contains:Database utilities, allowing you to connect to cloud databases using pyodbc in a standard pattern.Helpers around nested lists (flattening and unflattening).Helpers to make working with lists of dictionaries a bit easier so you don't have to resort to Pandas as fast.How to use the database helpersfrompggm_datalab_utils.dbimportcursor,querybbg_id='WOW'withcursor('pggm-sql-lre-o.database.windows.net','lre')asc:data=query(c,'select sedol, name from portfolio where bbg_id=?',bbg_id)
Package: pg-grant
pg_grantis a Python module for parsing, querying, and updating PostgreSQL
privileges.Installation$pipinstallpg_grant[sqlalchemy]Without the SQLAlchemy extra,pg_grantcan only parse access privileges.Example>>>frompg_grantimportparse_acl_item>>>parse_acl_item('bob=arw*/alice')Privileges(grantee='bob',grantor='alice',privs=['SELECT','INSERT'],privswgo=['UPDATE'])>>>fromsqlalchemyimportcreate_engine>>>frompg_grant.queryimportget_table_acl>>>engine=create_engine('postgresql://...')>>>get_table_acl(engine,'table2')SchemaRelationInfo(oid=138067,name='table2',owner='alice',acl=['alice=arwdDxt/alice','bob=arwdDxt/alice'],schema='public')>>>frompg_grantimportPgObjectType>>>frompg_grant.sqlimportrevoke>>>stmt=revoke(['SELECT'],PgObjectType.TABLE,'table2','bob')>>>str(stmt)'REVOKE SELECT ON TABLE table2 FROM bob'>>>engine.execute(stmt)AuthorsFrazer McLean <frazer@frazermclean.co.uk>DocumentationFor in-depth information,visit the
documentation!Developmentpg_grant usessemantic versioning
Package: pghero
pghero======pghero python port– Work in progress.Based on:* [https://github.com/ankane/pghero/blob/master/lib/pghero.rb](https://github.com/ankane/pghero/blob/master/lib/pghero.rb)* [http://www.craigkerstiens.com/2013/01/10/more-on-postgres-performance/](http://www.craigkerstiens.com/2013/01/10/more-on-postgres-performance/)* The internetz.Usage-----```pythonfrom core import pgherofrom sqlalchemy import create_enginedb_path = 'postgres://username@host:port/db'db = create_engine(db_path)pghero = pghero('sqlalchemy', db)```
Package: pghipy
pghipy: Phase Gradient Heap Integration in PythonA Python implementation of STFT/ISTFT transforms and phase recovery usingPhase Gradient Heap Integration. Based on code fromphase-reconstructionandtifgan/phase_recovery. The package does not require installation of ltfatpy and works in Windows/MacOS/Linux.InstallationpipinstallpghipyUsageimportlibrosaimportnumpyasnpfrompghipyimportget_default_window,calculate_synthesis_windowfrompghipyimportstft,pghi,istftNFFT=1024HOP=NFFT//8# Increasing overlap improves phase recovery# Create Gaussian windowswinpghi,gamma=get_default_window(NFFT)winsynth=calculate_synthesis_window(NFFT,HOP,winpghi)# Magnitude spectrogramy,sr=librosa.load(librosa.example('trumpet'))S=np.abs(stft(y,win_length=NFFT,hop_length=HOP,window=winpghi))# Estimate phasephase=pghi(S,win_length=NFFT,hop_length=HOP,gamma=gamma)# InvertS=S*np.exp(1.0j*phase)y_inv=istft(S,win_length=NFFT,hop_length=HOP,synthesis_window=winsynth)Note: UsesnumbaJIT compiler to obtain a significant speed-up in phase recovery. Compilation is deferred until the first execution of the function pghi (i.e., lazy compilation).DependenciesnumpyscipynumbaThanksRichard LymanrrlymanAndrés MarafiotiandimarafiotiLicenseThe MIT License (MIT)
Package: pg_hotcache
Limiter for loading into cache is the value of “effective_cache_size”.It makes sense to use after restarting the server!Before using, you need to connect to the database as superuser and add
the extension ‘pg_prewarm’ (added to PostgreSQL since version 9.4):create extension pg_prewarm;Usage:pg_hotcache [-?] [-h HOST] [-p PORT] [-U USERNAME] [-W PASSWORD] -d DBNAMEOptional arguments:-?, --help            show this help message and exit
-h HOST, --host HOST  database server host or socket directory (default:
                      "local socket")
-p PORT, --port PORT  database server port (default: "5432")
-U USERNAME, --username USERNAME
                      database user name (default: "unix user")
-W PASSWORD, --password PASSWORD
                      force password prompt (should happen automatically)
-d DBNAME, --dbname DBNAME
                      database name for cachingExamples:sudo -u postgres pg_hotcache -d dbname
pg_hotcache -h 127.0.0.1 -p 5432 -U username -d dbname
Package: pghstore
This small module implements a formatter and a loader forhstore,
one ofPostgreSQLsupplied modules, that stores simple key-value pairs.>>> dumps({u'a': u'1'})
'"a"=>"1"'
>>> loads('"a"=>"1"')
{u'a': u'1'}
>>> src = [('pgsql', 'mysql'), ('python', 'php'), ('gevent', 'nodejs')]
>>> loads(dumps(src), return_type=list)
[(u'pgsql', u'mysql'), (u'python', u'php'), (u'gevent', u'nodejs')]You can easily install the package fromPyPIby usingpiporeasy_install:$ pip install pghstoreVisit the website to read its documentation:https://pghstore.readthedocs.io/ChangelogVersion 2.0.2Fixes a segmentation fault caused by trying to parse invalid HStore strings.
See also (#13)Version 2.0.1 (unreleased to PyPI)Fixes a regression in behaviour with escape charactersVersion 2.0.0 (unreleased to PyPI)Supports Python 2.7+ and Python3.5+ both natively and with C extensionDrops support for Python 2.5 and 2.6Version 0.9.2Released on May 3, 2012.Fixed escaping of quotes and backslshes. Patched by Dan Watson (#2).Version 0.9.1Released on January 2, 2012.Now it is aware ofNULLvalues.NULLvalues becomeNonein
Python and vice versa.Version 0.9.0Released on December 22, 2011.Initial version.
Package: pgimp
pgimpInteracting with gimp in python3.Use Cases:Autocompletion for writing gimp scripts.Batch creation or update of gimp files or data extraction from gimp files.Workflows where machine learning data has to be annotated. Raw data
can be converted to gimp files where the annotation process can happen (gimp's thresholding tools
etc. make it easy to do annotation for pixelwise segmentation). After the masks are created, they
can be converted back to e.g. numpy files.Read thedocumentationfor details on what pgimp can
do for you and how it is achieved. Every single public method comes with a short working example!Skeletons for autocompleting gimp scriptsOn setup, theGimpDocumentationGeneratorwill generate python skeletons for the methods that gimp
exposes to the interpreter through the procedural database (pdb). This enables autocompletion in your IDE.Run a python script within gimpRunning python code within gimp is performed by theGimpScriptRunner. Have a look at the corresponding testGimpScriptRunnerTestto see how this works.You may import convenience functions frompgimp.gimpin your gimp python scripts.
Seepgimp.GimpScriptRunnerTest.test_import_from_pgimp_library.InstallationThe package managerpipand the python packagessetuptoolsandpsutilare required in order
to install the package. As gimp uses a python2 interpreter,
the pip packagesnumpyandtypingfor python2 need to be installed.Operating system dependent infosLinuxOn Linux, install the gimp package, e.g.sudo apt-get install gimpfor Debian/Ubuntu. In order to run headless,
install xfvb, e.g.sudo apt-get install xvfb.Mac OSInstall gimp from gimp.org or via homebrew.WindowsWindows is not supported.Using pippip3 install pgimpUsing condaUsing a conda environment.yml file:name: <NAME_OF_THE_ENV>
channels:
  - defaults
dependencies:
  - python=<3.6+>
  - pip:
    - pgimpFrom githubUsing pip:pip3 install git+https://github.com/mabu-github/pgimpUsing a conda environment.yml file:name: <NAME_OF_THE_ENV>
channels:
  - defaults
dependencies:
  - python=<3.6+>
  - pip:
    - "git+https://github.com/mabu-github/pgimp"LocalInstall using symlink to checked out code (for development):pip3 install -e .Contributing and PublishingSeeCONTRIBUTING.md.LicenseThis project is licensed under the MIT license. See theLICENSEfile for more info.
Package: pginit
This command-line tool reads django settings, then connects to
configured postgresql server as superuser, and tries to create the
database and user with password, according to the django settings.Installationpip install pginitUsageYou can either setDJANGO_SETTINGS_MODULEenvironment variable, or
specify settings module path in the first command-line argument.pginitpath.to.settings
Package: pgist
A Python command-line wrapper with github3.py library to access GitHub Gist.InstallationYou can install withpip:pip install pgist -UOr witheasy_install:easy_install -U pgistCommandTo upload the contents ofa.pyjust:pgist a.pyOr you can accept stdin as a file like this:pgist -typectrl+Dto end stdin andctrl+Cto abort.Upload multiple files:pgist a b cUse-pto make the gist private:pgist a.py -pUse-dto add a description:pgist -d "Say something" a.pyYou can update existing gists with-u:pgist b.py c.py -u 2c93e03266634cd6e273List your public gists:pgist -lAnd list all gists including private ones:pgist -l -ASeepgist –helpfor more detail.LoginIf you want to associate your gists with your GitHub account, you need to login
with pgist. It doesn’t store your username and password, it just uses them to get
an OAuth2 token (with the “gist” permission).pgist --login
GitHub username(default is xxxxx): douglarek
GitHub password for douglarek:
Done ...After you’ve done this, you can still upload gists anonymously with-a:pgist a.py -aThanksgithub3.pyby Ian Cordasco.LicenseLicensed under the Apache 2.0 license.Bug-reports, and pull requestsare welcome.
Package: pgjobq
pgjobqA job queue built on top of Postgres.Project statusPlease do not use this for anything other than experimentation or inspiration.
At some point I may decide to support this long term (at which point this warning will be removed), but until then this is just a playground subject to breaking changes (including breaking schema changes).PurposeSometimes you have a Postgres database and need a queue.
You could stand up more infrastructure (SQS, Redis, etc), or you could use your existing database.
There are plenty of use cases for a persistent queue that do not require infinite scalability, snapshots or any of the other advanced features full fledged queues/event buses/job brokers have.FeaturesBest effort at most once delivery (jobs are only delivered to one worker at a time)Automatic redelivery of failed jobs (even if your process crashes)Low latency delivery (near realtime, uses PostgreSQL'sNOTIFYfeature)Low latency completion tracking (usingNOTIFY)Dead letter queuingJob attributes and attribute filteringJob dependencies (for processing DAG-like workflows or making jobs process FIFO)Persistent scheduled jobs (scheduled in the database, not the client application)Job cancellation (guaranteed for jobs in the queue and best effort for checked-out jobs)Bulk sending and polling to support large workloadsBack pressure / bound queuesFully typed async Python client (usingasyncpg)Exponential back off for retriesTelemetry hooks for sampling queries with EXPLAIN or integration with OpenTelemetry.Possible features:Reply-to queues and response handlingExamplesfromcontextlibimportAsyncExitStackimportanyioimportasyncpg# type: ignorefrompgjobqimportcreate_queue,connect_to_queue,migrate_to_latest_versionasyncdefmain()->None:asyncwithAsyncExitStack()asstack:pool:asyncpg.Pool=awaitstack.enter_async_context(asyncpg.create_pool(# type: ignore"postgres://postgres:postgres@localhost/postgres"))awaitmigrate_to_latest_version(pool)awaitcreate_queue("myq",pool)queue=awaitstack.enter_async_context(connect_to_queue("myq",pool))asyncwithanyio.create_task_group()astg:asyncdefworker()->None:asyncwithqueue.receive()asmsg_handle_rcv_stream:# receive a single jobasyncwith(awaitmsg_handle_rcv_stream.receive()).acquire():print("received")# do some workawaitanyio.sleep(1)print("done processing")print("acked")tg.start_soon(worker)tg.start_soon(worker)asyncwithqueue.send(b'{"foo":"bar"}')ascompletion_handle:print("sent")awaitcompletion_handle.wait()print("completed")tg.cancel_scope.cancel()if__name__=="__main__":anyio.run(main)# prints:# "sent"# "received"# "done processing"# "acked"# "completed"DevelopmentClone the repoStart a disposable PostgreSQL instance (e.gdocker run -it -e POSTGRES_PASSWORD=postgres -p 5432:5432 postgres)Runmake testSee this release on GitHub:v0.10.0
Package: pg_jts
Create JSON-table-schemas from a live PostgreSQL databasePython3 alpha code(JSON table schema is an extensible standard for describing tabular data:http://dataprotocols.org/json-table-schema)Documentation:https://pg_jts.readthedocs.org/If you provide patches, please also consider patchinghttps://github.com/iburadempa/jts_erd/accordingly.
Package: pgldapsync
pgldapsyncThis Python module allows you to synchronise Postgres login roles
with users in an LDAP directory.In order to use it, you will need to create aconfig.inifile containing the site-specific configuration you require.
Seeconfig.ini.examplefor a complete list of all the
available configuration options. This file should be copied to
create your own configuration.Once configured, simply run pgldapsync like so:python pgldapsync.py /path/to/config.iniIn order to test the configuration (and dump the SQL that would
be executed to stdout), run it like this:python pgldapsync.py --dry-run /path/to/config.iniCreating a virtual environment for dev/testAssuming you have the virtualenv package installed:venv pgldapsync
source pgldapsync/bin/activate.sh
pip install -r requirements.txtAdapt the first command as required for your environment/Python
version.Creating a packageTo create a package (wheel), run the following in your virtual
environment:python setup.py sdist bdist_wheel --universalCopyright 2018 - 2021, EnterpriseDB Corporation
Package: pglet
Pglet - quickly build interactive web apps in PythonPgletis a rich User Interface (UI) framework to quickly build interactive web apps in Python without prior knowledge of web technologies like HTTP, HTML, CSS or JavaSscript. You build UI withcontrolswhich useFluent UI Reactto ensure your programs look cool and professional.RequirementsPython 3.7 or above on Windows, Linux or macOSInstallationpip install pgletHello, world!importpgletfrompgletimportTextp=pglet.page()p.add(Text("Hello, world!"))Run the sample above and a new browser window will pop up:Continue withPython tutorialdemonstrating how to build a simple To-Do web app and share it on the internet.Browse for morePglet examples.Join to a conversation onPglet Discord server.
Package: pglift
What is pglift?pglift is a solution aiming at deploying production-ready instances of
PostgreSQL, set up, backed up and monitored.Here, the term "instance" means a plain PostgreSQL instance (aka a cluster)
complemented with satellite services which are essential to ensure proper
operation in a production context. These satellite components typically
concern backup, monitoring, high-availability or migration.The project aims at supporting several tools for each category. At the moment,
supported tools are:Backup:pgBackRestMonitoring & insights:Prometheus postgres_exporter,temBoard,PoWAHigh availability:PatroniGetting Startedwalk through thedocumentationfor installation and tutorialssee also thedevelopment and contributing guideDocumentationThe pglift documentation can be found athttps://pglift.readthedocs.io.LicenseThe code in this repository is developed and distributed under the GNU General
Public License version 3. SeeLICENSEfor details.