semvec/pypi-packages huggingface dataset:
lonny-pg-queue 10.0.2
A lightweight distributed queue using a postgres DB.
Requires Python: >=3.8,<4.0

# `lonny_pg_queue`

A lightweight distributed queue using a postgres DB.

## Installation

```bash
pip install lonny_pg_queue
```

## Usage

The first step is importing the `Queue` class. This can be done as:

```python
from lonny_pg_queue import Queue
```

We then need to ensure the requisite queue table is implemented. This can be done by passing a `lonny_db` connection object to the `Queue.setup(db)` method (This method is idempotent and can be run multiple times).

To create a `queue` object simply invoke the constructor with a `lonny_db` connection and a mandatory `namespace`:

```python
queue_1 = Queue(db, "queue_1")
queue_2 = Queue(db, "queue_2")
```

The messages placed in these queues will be isolated from one another.

To enqueue objects, simply call `queue.put(obj)` on any JSON serializable object.

To retrieve an object from the queue, call `queue.get()`. This will return a `Message` object. The underlying payload can be accessed via `message.payload`. Messages work similar to how they work in AWS SQS - messages retrieved from the queue are immediately "locked". In this state they cannot be retrieved by another consume. After a timeout, they become unlocked and can be accessed as before by another consumer. This happens a maximum number of times until the message is deleted permanently. 

Once you are done with a message, you should call `.consume()` on it - this will prevent it being accessed again at a later point. To simplify this procedure, we can use the `with` syntax:

```python
with queue.get() as payload:
    do_stuff(payload)
```

If we leave the block with no exception, the message is consumed/deleted as expected. However, if something goes wrong, `consume` isn't called, giving us another chance in the future to handle this message.
PRINTSHORTCUT 0.0.2
Print and input shortcut
Requires Python: >=3.0

description:
GO TO MY bLOG FOR ADVANCE DETAILS:https://knpjg.blogspot.com/2020/07/my-own-python-shortcutio-libiary.html

HOW CAN WE WORKS WITH MY PACKAGE
-------------
YOU CAN IMPORT THE Shortcut PYTHON FILE

THIS IS A MAGIC PRINT AND INPUT FUNCTION LIBRARY, IT SUPPORTS VARROUS LANGAUGES SUCH AS TO SHORT PRINT AND INPUT FUNCTION.
THE FUNCTION ARE GIVEN BELOW
documentwrite(),ip(),cout(),printf(),P(),p(),and other you can see by help command 
EXAMPLE
P("HELLO WORLD")#THE O/P IS-HELLO WORLD

IT ALSO OTHER  PROGRMMING LANGUAGES PRINT STATEMENT
SUCH AS-JAVA,JAVASCRIPT,C,C++,
import System
System.out.print("hello")#THE O/P IS-HELLO 
WHY IT IS MAGIC LIBRARY?
ANS-IF YOU WANT TO print one python file data in another python file ,then you simple import file name in your file
example-
my module or python file name is-praticeall
my progrmme is given below:

from Shortcut import *
A=1#YOU CAN USE VARIABLES
p(A,"hello")

my 2nd module or 2nd python file name is-pratice2
my progrmme is given below:
import Shortcut
import praticeall
Shortcut.p("KESHARI")
O/P
----
1 hello 
KESHARI

------------------------------------------------------------------
MY 2ND FUNCTION WORKS LIKES A INPUT FUNCTION 
IT ALSO TAKES INPUT 
THE EXAMPLE IS:
s=cin("Enetr a number")
print(s)
s=i("Enetr a number")
print(s)
s=scanf("Enetr a number")
print(s)

Change Log
==========


0.0.1(23/07/2020)
------------------
First Release
lonny-pg-migrate 10.0.0
A CLI for managing postgres DB migrations
Requires Python: >=3.8,<4.0

# `lonny_pg_migrate`

A CLI for managing postgres DB migrations. 

## Installation

```bash
pip install lonny_pg_migrate
```

## Usage

First, we must create a `MigrationRunner` object. We can do this like:

```python
from lonny_pg_migrate import MigrationRunner

# Get a 'lonny_pg' DB connection.
db = get_lonny_pg_connection()

runner = MigrationRunner(db)
```

To define a migration, we can simply now do:

```python
# N.B. sort_key is optional and defaults to the slug.
@runner.migrate("migration_0", sort_key = "0")
def migration_0(db):
    do_some_action(db)
```

To perform the migration, we can either invoke the runner directly using:

```python
# This will wipe the database
runner.drop()
# This will run - in order of sort_key, all migrations which haven't yet run.
runner.migrate()
```

Or via the CLI using:

```bash
pg_migrate path.to.module:runner_var
```

As above, `drop` functionality is supported by passing in a `--drop` argument.
lonny-pg 0.1.1
A quality-of-life wrapper for the psycopg2 connection object.
Requires Python: >=3.8,<4.0

# `lonny_pg`

A quality-of-life wrapper for the psycopg2 connection object.

## Installation

```bash
pip install lonny_pg
```

## Usage

To import the connection object, simply do:

```python
from lonny_pg import Connection
```

 - The connection object constructor takes `host`, `port`, `dbname`, `user` and `password` kwargs.
 - The connection isn't initialized until a query is made or `init` is explicitly called.
 - The connection can be closed by using `close` - however it can be subsequently re-opened at anytime. When used in a `with` contextmanager context - the connection is closed when leaving the block.
 - The 3 methods for querying the database are: `execute`, `fetch_one` and `fetch_all`. All of these can either take a SQL string, or a callable (see the `lonny_sql` module for usage).
 - This connection wrapper uses `autocommit` mode and the `DictCursor` for returning results.

 ### Nested Transactions

Nested transactions are possible using this library. The outermost transaction uses a standard `TRANSACTION` construct. Inner transactions use a `SAVEPOINT` instead.

```python
conn = Connection(**kwargs)
with conn.transaction():
    try:
        do_something_else()
        with conn.transaction():
            do_something()
    except:
        pass
```