Skip to main content

简单修改pugsql 使其支持直接执行sql。

使用

from hisql import *
from datetime import datetime

q = hisql()
q.connect('mysql+pymysql://bbq:bbq@localhost/bbq')
# 选择9.1号前10个接近10块股票
res = q.execute('select a.code as code, b.name as name, a.close as close '
                'from stock_daily a left join stock_info b on a.code=b.code '
                'where a.trade_date=:trade_date and a.close < 10 order by close desc limit 10',
                Many(), trade_date=datetime(year=2021, month=9, day=1))
data = [d for d in res]
data

结果

[{'code': 'sz002820', 'name': '桂发祥', 'close': Decimal('9.9900')},
 {'code': 'sz002556', 'name': '辉隆股份', 'close': Decimal('9.9700')},
 {'code': 'sz002322', 'name': '理工环科', 'close': Decimal('9.9700')},
 {'code': 'sz000920', 'name': '南方汇通', 'close': Decimal('9.9600')},
 {'code': 'sz002545', 'name': '东方铁塔', 'close': Decimal('9.9600')},
 {'code': 'sz002926', 'name': '华西证券', 'close': Decimal('9.9600')},
 {'code': 'sh603056', 'name': '德邦股份', 'close': Decimal('9.9600')},
 {'code': 'sz300434', 'name': '金石亚药', 'close': Decimal('9.9500')},
 {'code': 'sz300437', 'name': '清水源', 'close': Decimal('9.9400')},
 {'code': 'sz300030', 'name': '阳普医疗', 'close': Decimal('9.9300')}]

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hisql-0.0.2.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hisql-0.0.2-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file hisql-0.0.2.tar.gz.

File metadata

  • Download URL: hisql-0.0.2.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.0

File hashes

Hashes for hisql-0.0.2.tar.gz
Algorithm Hash digest
SHA256 f55a3ff25f03706d6c8046801d6272f8b735ec7eed31af1604a24bb854b7d4d1
MD5 ce8e3b095bf6bd30c23fbb0739df921b
BLAKE2b-256 4409131dd6f8417299715366987021c5bb44a038cfe219ffb65af3440e5eb3b5

See more details on using hashes here.

File details

Details for the file hisql-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: hisql-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.0

File hashes

Hashes for hisql-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ee4c9fac6a978df463ac232884aadeafea46f9bf814d9e8447862704083704cd
MD5 044bcf3a9ae15ecdb44b3d0aa8142442
BLAKE2b-256 af9cc5651ace26036f56641d06361ba41bc434c588dc90a70de6f125a9e0fec6

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 files

0.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page