
Security News
GitHub Actions Supply Chain Attack Puts Thousands of Projects at Risk
A compromised GitHub Action exposed secrets in CI/CD logs, putting thousands of projects at risk and forcing developers to urgently secure their workflows.
.. image:: https://img.shields.io/pypi/v/lorm.svg :target: https://pypi.python.org/pypi/lorm
Lorm is a light weight mysql client library for Python. Built-in connection pool, Django style lookup expressions.
The last stable release is available on PyPI and can be installed with pip
::
$ pip install lorm
.. code:: sql
CREATE TABLE `pets` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(20) NOT NULL DEFAULT '',
`add_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
Connect to Mysql
.. code:: python
>>> import pymysql
>>> import lorm
>>> db = lorm.Hub(pymysql)
>>> db.add_pool('default', host='localhost', port=3306, user='root',
passwd='root', db='test', autocommit=True, pool_size=8, wait_timeout=30)
Insert
.. code:: python
>>> db.default.pets.create(name='cat')
1
Query
.. code:: python
>>> db.default.pets.get(id=1)
{u'id': 2, u'name': u'cat'}
Row Style
.. code:: python
>>> db.default.pets.filter(id__lt=10).select('id')[:]
[{u'id': 1}, {u'id': 2}, {u'id': 4}, {u'id': 5}, {u'id': 6}, {u'id': 7}, {u'id': 8}, {u'id': 9}]
>>> db.default.pets.filter(id__lt=10).values('id')[:]
((1,), (2,), (4,), (5,), (6,), (7,), (8,), (9,))
>>> db.default.pets.filter(id__lt=10).flat('id')[:]
[1, 2, 4, 5, 6, 7, 8, 9]
Raw SQL
.. code:: python
>>> db.default.fetchall("select * from pets")
((1, u'cat'), (2, u'dog'), (3, u'bird'))
Transaction
.. code:: python
>>> with db.default as c:
>>> print c.pets.create(name='fish')
For more examples, see example.py <https://github.com/zii/lorm/blob/master/example.py>
_
FAQs
A light weight mysql client library.
We found that lorm demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A compromised GitHub Action exposed secrets in CI/CD logs, putting thousands of projects at risk and forcing developers to urgently secure their workflows.
Research
Security News
A malicious Maven package typosquatting a popular library is secretly stealing OAuth credentials on the 15th of each month, putting Java developers at risk.
Security News
Socket and Seal Security collaborate to fix a critical npm overrides bug, resolving a three-year security issue in the JavaScript ecosystem's most popular package manager.