shakedown.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
A community for live music fans with roots in the jam scene. Shakedown Social is run by a team of volunteers (led by @clifff and @sethadam1) and funded by donations.

Administered by:

Server stats:

266
active users

#sqlalchemy

0 posts0 participants0 posts today
James Bennett<p>I have a <a href="https://infosec.exchange/tags/Python" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Python</span></a> codebase using <a href="https://infosec.exchange/tags/sqlalchemy" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>sqlalchemy</span></a> Core -- *NOT* ORM -- for its data layer, and I'm currently not happy with the way it's doing data for testing. Who has a pattern for this that they actually like?</p><p>I already have ephemeral per-test-function isolation of the database, so that's taken care of.</p><p>If this were ORM I'd just use something like factory-boy, but the fact that it's Core and doesn't really map neatly to objects the way ORM stuff does rules that out. I think ideally what I'd like is some sort of declarative JSON file format or whatever that lets me provide a mapping of table names to lists of rows to insert into them, and then a pytest fixture that lets me say "load that JSON file for this test". Has anyone written something like that? Do I get to go write my own?</p>
Richard Hughes<p>Does anyone know how to make <a href="https://mastodon.social/tags/SQLAlchemy" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SQLAlchemy</span></a> queries slightly less verbose? e.g. "SELECT firmware.filename AS firmware_filename, firmware.version_display AS firmware_version_display..." could be a lot shorter. Amazon <a href="https://mastodon.social/tags/RDS" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>RDS</span></a> truncates the query to 4096 characters....</p>
Rob Hafner :verified_bi:<p>I've got a sneak peak of my latest open source project: Paracelsus.</p><p>Long story short, I got sick of manually making database diagrams for SQLAlchemy. The data is all there, so why not generate the diagrams directly?</p><p>Paracelsus (named after the alchemist who wrote about mermaids) will read your database models and create diagrams in either Mermaid or Dot format. It can also be used to inject diagrams in markdown files as code blocks.</p><p><a href="https://hachyderm.io/tags/python" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>python</span></a> <a href="https://hachyderm.io/tags/sqlalchemy" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>sqlalchemy</span></a> <a href="https://hachyderm.io/tags/opensource" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>opensource</span></a></p><p><a href="https://github.com/tedivm/paracelsus" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="">github.com/tedivm/paracelsus</span><span class="invisible"></span></a></p>
Brian :python: :flask: :html5:<p>In Python (specifically, SQLAlchemy if possible) what's the best way to get a list of results from a relationship into a dict?</p><p>I have:</p><p>[{'id':1, 'parent':1, 'score':2}, {'id':2, 'parent':2, 'score':3}, {'id':3, 'parent':1, 'score':3},...] </p><p>And I'd like:</p><p>[{'parent':1, 'scores': [2, 3], 'parent':2, 'scores': [3],...]</p><p>The records are against a user, so already filtering for the relevant rows.</p><p>I went in circles today and I can't seem to find the right procedure. Any tips?</p><p><a href="https://fosstodon.org/tags/python" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>python</span></a> <a href="https://fosstodon.org/tags/sqlalchemy" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>sqlalchemy</span></a></p>