Science Score: 23.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
2 of 50 committers (4.0%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.4%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
SQL for Humans™
Basic Info
- Host: GitHub
- Owner: kennethreitz
- License: isc
- Language: Python
- Default Branch: master
- Homepage: https://pypi.python.org/pypi/records/
- Size: 306 KB
Statistics
- Stars: 7,215
- Watchers: 185
- Forks: 577
- Open Issues: 44
- Releases: 1
Topics
Metadata Files
README.md
Records: SQL for Humans™
Records is a very simple, but powerful, library for making raw SQL queries to most relational databases.

Just write SQL. No bells, no whistles. This common task can be surprisingly difficult with the standard tools available. This library strives to make this workflow as simple as possible, while providing an elegant interface to work with your query results.
Database support includes RedShift, Postgres, MySQL, SQLite, Oracle, and MS-SQL (drivers not included).
☤ The Basics
We know how to write SQL, so let's send some to our database:
``` python import records
db = records.Database('postgres://...') rows = db.query('select * from activeusers') # or db.queryfile('sqls/active-users.sql') ```
Grab one row at a time:
``` python
rows[0]
```
Or iterate over them:
python
for r in rows:
print(r.name, r.user_email)
Values can be accessed many ways: row.user_email, row['user_email'],
or row[3].
Fields with non-alphanumeric characters (like spaces) are also fully supported.
Or store a copy of your record collection for later reference:
``` python
rows.all() [
, , , ...] ```
If you're only expecting one result:
``` python
rows.first()
```
Other options include rows.as_dict() and rows.as_dict(ordered=True).
☤ Features
- Iterated rows are cached for future reference.
-
$DATABASE_URLenvironment variable support. - Convenience
Database.get_table_namesmethod. - Command-line records tool for exporting queries.
- Safe parameterization:
Database.query('life=:everything', everything=42). - Queries can be passed as strings or filenames, parameters supported.
- Transactions:
t = Database.transaction(); t.commit(). - Bulk actions:
Database.bulk_query()&Database.bulk_query_file().
Records is proudly powered by SQLAlchemy and Tablib.
☤ Data Export Functionality
Records also features full Tablib integration, and allows you to export your results to CSV, XLS, JSON, HTML Tables, YAML, or Pandas DataFrames with a single line of code. Excellent for sharing data with friends, or generating reports.
``` pycon
print(rows.dataset) username|active|name |user_email |timezone --------|------|----------|-----------------|-------------------------- model-t |True |Henry Ford|model-t@gmail.com|2016-02-06 22:28:23.894202 ... ```
Comma Separated Values (CSV)
``` pycon
print(rows.export('csv')) username,active,name,user_email,timezone model-t,True,Henry Ford,model-t@gmail.com,2016-02-06 22:28:23.894202 ... ```
YAML Ain't Markup Language (YAML)
``` python
print(rows.export('yaml')) - {active: true, name: Henry Ford, timezone: '2016-02-06 22:28:23.894202', user_email: model-t@gmail.com, username: model-t} ... ```
JavaScript Object Notation (JSON)
``` python
print(rows.export('json')) [{"username": "model-t", "active": true, "name": "Henry Ford", "user_email": "model-t@gmail.com", "timezone": "2016-02-06 22:28:23.894202"}, ...] ```
Microsoft Excel (xls, xlsx)
python
with open('report.xls', 'wb') as f:
f.write(rows.export('xls'))
Pandas DataFrame
``` python
rows.export('df') username active name user_email timezone 0 model-t True Henry Ford model-t@gmail.com 2016-02-06 22:28:23.894202 ```
You get the point. All other features of Tablib are also available, so you can sort results, add/remove columns/rows, remove duplicates, transpose the table, add separators, slice data by column, and more.
See the Tablib Documentation for more details.
☤ Installation
Of course, the recommended installation method is pipenv:
$ pipenv install records[pandas]
✨🍰✨
☤ Thank You
Thanks for checking this library out! I hope you find it useful.
Of course, there's always room for improvement. Feel free to open an issue so we can make Records better, stronger, faster.
Owner
- Name: Kenneth Reitz
- Login: kennethreitz
- Kind: user
- Location: Virginia, USA, Earth, Milky Way.
- Website: kennethreitz.org
- Twitter: kennethreitz42
- Repositories: 26
- Profile: https://github.com/kennethreitz
Software Engineer focused on abstractions, reducing cognitive overhead, and Design for Humans.
GitHub Events
Total
- Issues event: 3
- Watch event: 96
- Issue comment event: 5
- Pull request event: 1
- Pull request review comment event: 1
- Pull request review event: 2
- Fork event: 16
Last Year
- Issues event: 3
- Watch event: 96
- Issue comment event: 5
- Pull request event: 1
- Pull request review comment event: 1
- Pull request review event: 2
- Fork event: 16
Committers
Last synced: 9 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Kenneth Reitz | me@k****g | 202 |
| Jan Vlcinsky | j****y@t****m | 15 |
| Chad Whitacre | c****d@z****m | 11 |
| Harold Cooper | h****r@g****m | 6 |
| mcdallas | m****s@h****m | 6 |
| Brobin | t****n@g****m | 3 |
| Greg Troszak | g****k@g****m | 3 |
| Joakim Uddholm | t****k@g****m | 3 |
| prasad83 | p****3 | 2 |
| Waldir Pimenta | w****s@g****m | 2 |
| Nikhil Murthy | n****y@g****m | 2 |
| Hugo | h****k | 2 |
| Frazer McLean | f****r@f****k | 2 |
| Daniel Schep | d****p@g****m | 2 |
| Brian Hammond | b****n@f****m | 2 |
| Andrew Doroschenko | a****n@y****u | 2 |
| Kenneth Reitz | k****z@K****l | 2 |
| arokosaki | a****i | 2 |
| wanpeng | w****g@g****v | 1 |
| TomFaulkner | T****m@t****m | 1 |
| Paul Philip Voelker | p****r@c****e | 1 |
| Alan King | k****j@u****m | 1 |
| Andrew Murray | r****e@g****m | 1 |
| Beha | s****p@m****m | 1 |
| Brent Tubbs | b****s@g****m | 1 |
| restran | g****n@g****m | 1 |
| fritz-clicktripz | f****z@c****m | 1 |
| dependabot[bot] | 4****] | 1 |
| WangWeigao | w****o@g****m | 1 |
| Varun Agrawal | v****l@g****m | 1 |
| and 20 more... | ||
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 82
- Total pull requests: 27
- Average time to close issues: 10 months
- Average time to close pull requests: over 3 years
- Total issue authors: 71
- Total pull request authors: 25
- Average comments per issue: 2.78
- Average comments per pull request: 1.04
- Merged pull requests: 15
- Bot issues: 0
- Bot pull requests: 3
Past Year
- Issues: 4
- Pull requests: 2
- Average time to close issues: 6 days
- Average time to close pull requests: N/A
- Issue authors: 4
- Pull request authors: 2
- Average comments per issue: 0.75
- Average comments per pull request: 1.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- leafonsword (4)
- hrldcpr (3)
- chadwhitacre (3)
- bfmcneill (2)
- vlcinsky (2)
- mcdallas (2)
- zhonghai9967 (2)
- laith43d (1)
- sri-rang (1)
- ragne (1)
- emirot (1)
- schlsj (1)
- tspivey (1)
- aklaver (1)
- Imran-imtiaz48 (1)
Pull Request Authors
- dependabot[bot] (4)
- jraper3 (2)
- arokosaki (2)
- Imran-imtiaz48 (2)
- shacknetisp (2)
- paulvoe (2)
- takhogan (2)
- jdonboch (2)
- kingaj12 (2)
- keelanfh (2)
- kipyin (2)
- bfmcneill (2)
- NaelsonDouglas (2)
- prasad83 (2)
- mkai (2)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 4
-
Total downloads:
- pypi 266,904 last-month
- Total docker downloads: 79
-
Total dependent packages: 11
(may contain duplicates) -
Total dependent repositories: 256
(may contain duplicates) - Total versions: 29
- Total maintainers: 3
pypi.org: records
SQL for Humans
- Homepage: https://github.com/kennethreitz/records
- Documentation: https://records.readthedocs.io/
- License: ISC
-
Latest release: 0.6.0
published almost 2 years ago
Rankings
Maintainers (2)
proxy.golang.org: github.com/kennethreitz/records
- Documentation: https://pkg.go.dev/github.com/kennethreitz/records#section-documentation
- License: isc
-
Latest release: v0.6.0
published almost 2 years ago
Rankings
pypi.org: records-csp
SQL for Humans
- Homepage: https://github.com/kennethreitz/records
- Documentation: https://records-csp.readthedocs.io/
- License: ISC
-
Latest release: 0.5.3.1
published over 3 years ago
Rankings
Maintainers (1)
conda-forge.org: records
- Homepage: https://github.com/kennethreitz/records
- License: ISC
-
Latest release: 0.5.3
published over 4 years ago