Replies: 1 comment
-
Using »Records« with »CrateDB«Hi again. We added two folders to the CrateDB Examples Repository, each one including a few examples, that use the Records library and program together with CrateDB. It works well, apparently including support for all special data types of CrateDB.
Building upon all the powers of SQLAlchemy, both the API and CLI interfaces of Records are very convenient, providing perfect DWIM on your fingertips, and making them an excellent dynamic duo. Thanks a stack, @kennethreitz. Install# Install Records with support for CrateDB.
pipx install records sqlalchemy-cratedb
# Quickly spin up an instance of CrateDB.
docker run --rm --name=cratedb --publish=4200:4200 --publish=5432:5432 crate -Cdiscovery.type=single-node SynopsisShellexport DATABASE_URL="crate://" Text
YAML# $ records "SELECT * FROM sys.summits WHERE region ILIKE :region" yaml region="ortler%"
- classification: II/C-28.I-A
coordinates: [10.54472, 46.50889]
country: IT
first_ascent: 1804
height: 3905
mountain: Ortler
prominence: 1953
range: South Tyrol
region: Ortler Alps CSV
Pythonimport records, pprint
db = records.Database("crate://")
pprint.pprint(db.query("SELECT * FROM sys.summits ORDER BY height DESC LIMIT 3").all()) [<Record {"classification": "I/B-07.V-B", "coordinates": [6.86444, 45.8325], "country": "FR/IT", "first_ascent": 1786, "height": 4808, "mountain": "Mont Blanc", "prominence": 4695, "range": "U-Savoy/Aosta", "region": "Mont Blanc massif"}>,
<Record {"classification": "I/B-09.III-A", "coordinates": [7.86694, 45.93694], "country": "CH", "first_ascent": 1855, "height": 4634, "mountain": "Monte Rosa", "prominence": 2165, "range": "Valais", "region": "Monte Rosa Alps"}>,
<Record {"classification": "I/B-09.V-A", "coordinates": [7.85889, 46.09389], "country": "CH", "first_ascent": 1858, "height": 4545, "mountain": "Dom", "prominence": 1046, "range": "Valais", "region": "Mischabel"}>] /cc @karynzv, @WalBeh, @seut, @matriv, @surister, @hlcianfagna, @hammerhead, @wierdvanderhaar, @simonprickett, @zolbatar |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Beta Was this translation helpful? Give feedback.
All reactions