Re: [sqlalchemy] Soft Delete Pattern

2023-07-03 Thread Andrew Martin
ng_query/filter_public.html > > > On Mon, Jul 3, 2023, at 11:13 PM, Andrew Martin wrote: > > Hello, > > I have a base class I tend to use that includes a Boolean is_deleted field > so that pretty much every object has that available. > > Is there a good pattern fo

[sqlalchemy] Soft Delete Pattern

2023-07-03 Thread Andrew Martin
Hello, I have a base class I tend to use that includes a Boolean is_deleted field so that pretty much every object has that available. Is there a good pattern for setting a filter on these objects that automatically adds a WHERE is_deleted = 'false'? Or does that just have to be added as a

Re: [sqlalchemy] Session management for general functions within a class

2022-04-29 Thread Andrew Martin
eady > belongs to. > > Hope that helps, > > Simon > > On Fri, Apr 29, 2022 at 5:10 AM Andrew Martin wrote: > >> Hi all, I'm struggling a bit with best practices for my ETL application. >> >> Each part of the ETL app is completely separate from the others, but

[sqlalchemy] Session management for general functions within a class

2022-04-28 Thread Andrew Martin
Hi all, I'm struggling a bit with best practices for my ETL application. Each part of the ETL app is completely separate from the others, but I have a MixIn for some common functions that each of them need to do, like move this record to error if there's a data integrity problem. Or move this

[sqlalchemy] Idiomatic way to track state during ETL processing

2022-02-28 Thread Andrew Martin
I haven't found any topics here that address this, so it may mean that the answer is so simple that I'm just overthinking here. Context: I'm the lone developer on a new tech team at a company that's never had any team in place before. Everything is greenfield. Which is great because I get to

[sqlalchemy] Comparing an SQLAlchemy object to a similar object

2021-04-10 Thread Andrew Martin
Hi everyone, This might be a totally premature optimization, but I want to at least start off in the right direction. I'm pulling messages from a slack channel into an Airflow DAG and writing events to a table if certain attributes of the slack message has changed. Slack message structures

Re: [sqlalchemy] Generic File Loader issue with Booleans

2020-10-28 Thread Andrew Martin
I will reproduce this when I get done with work this evening and give the specifics. On Wednesday, October 28, 2020 at 7:46:26 AM UTC-5, Mike Bayer wrote: > > > > On Tue, Oct 27, 2020, at 11:56 PM, Andrew Martin wrote: > > This is probably a weirdly specific question, but

[sqlalchemy] Generic File Loader issue with Booleans

2020-10-27 Thread Andrew Martin
This is probably a weirdly specific question, but I have a workflow that involves loading lots of CSVs into Postgres. Some of them are very large, so I want to cut overhead and not use CSV Dictreader. Wanted to use named tuples instead. Here's a header and a line from a file:

[sqlalchemy] Re: Regarding Data type consideration

2019-08-18 Thread Andrew Martin
Hi Mohan, Could you give us some more information about the structure of your Dataframe and how you are using SqlAlchemy? On Sunday, August 18, 2019 at 4:24:09 AM UTC-5, Mohan Raj wrote: > > Hi, > > I used "sqlalchemy" in my python code for inserting a Dataframe from > Pandas(0.25.0) to

Re: [sqlalchemy] How to inspect filters

2019-06-27 Thread Andrew Martin
past the block, that way I'm not so surprised by answer that Mike and people like you give me. Anyway, probably TMI. Cheers and thanks! On Thu, Jun 27, 2019 at 11:09 AM Jonathan Vanasco wrote: > > > On Wednesday, June 26, 2019 at 2:43:44 PM UTC-4, Andrew Martin wrote: >> >> Th

Re: [sqlalchemy] How to inspect filters

2019-06-26 Thread Andrew Martin
That's very interesting, Jonathan. Could you show me a quick example of that approach? I'm not sure I *need* to do that, but I think I would learn about SQLAlchemy from such an example and trying to understand it. On Wed, Jun 26, 2019 at 11:00 AM Jonathan Vanasco wrote: > FWIW, I found a better

Re: [sqlalchemy] How to inspect filters

2019-06-25 Thread Andrew Martin
Thank you, as always, for both the specific answer and the general advice. Much appreciated! On Sunday, June 23, 2019 at 5:19:49 PM UTC-5, Mike Bayer wrote: > > > > On Sun, Jun 23, 2019, at 5:45 PM, Andrew Martin wrote: > > I have a generic CRUDService for my web a

[sqlalchemy] How to inspect filters

2019-06-23 Thread Andrew Martin
I have a generic CRUDService for my web app. It's a pattern that was loosely suggested to me by Mike a while back. I've probably not implemented it the way he intended, but it works pretty well in a pretty small amount of code. The main work, however, that needs to be done is in the read_all

Re: [sqlalchemy] Re: Better Implementation of Query Mixin?

2019-03-24 Thread Andrew Martin
parent and you then > refactor. > > e.g. don't overplan ahead, do it stupidly simple then expect to > refactor a few times.but also don't create state where it isnt > needed, if that makes sense. > > > On Sat, Mar 23, 2019 at 11:24 AM Andrew Martin > wrote: >

Re: [sqlalchemy] Re: Better Implementation of Query Mixin?

2019-03-23 Thread Andrew Martin
refactor. > > e.g. don't overplan ahead, do it stupidly simple then expect to > refactor a few times.but also don't create state where it isnt > needed, if that makes sense. > > > On Sat, Mar 23, 2019 at 11:24 AM Andrew Martin > wrote: > > > >

[sqlalchemy] Re: Better Implementation of Query Mixin?

2019-03-23 Thread Andrew Martin
I just realized that almost everything about how I'm using mixins here is pretty much wrong. This is probably a garbage question and can be deleted, but I don't want to do it myself in case someone is writing a response to tell me that. On Saturday, March 23, 2019 at 9:00:49 AM UTC-5, Andrew

[sqlalchemy] Better Implementation of Query Mixin?

2019-03-23 Thread Andrew Martin
I like to keep my models separate from actions on it, so I only use them for defining tables, relationships, and indexes. To perform actions on a model I use a service that inherits from the model and provides . . . well. services. It's an interface pattern. I'm making these more generic, and

Re: [sqlalchemy] Re: Polymorphic Query All regardless of subclass

2019-03-01 Thread Andrew Martin
at, I don't have > a pressing need to figure out the other way you were doing it if you > dont. > > > On Fri, Mar 1, 2019 at 12:23 PM Andrew Martin > wrote: > > > > Thanks for the reply, Mike. I should've offered the SQL equivalent of > what I was going for to

[sqlalchemy] Re: Polymorphic Query All regardless of subclass

2019-03-01 Thread Andrew Martin
to grab the whole dataset in that format. Thanks! On Thursday, February 28, 2019 at 12:34:16 PM UTC-6, Andrew Martin wrote: > > Hi All, > > Trying something out here for an analytics app here, and I'm not sure any > of this is a good idea. I'm trying to create a data model

[sqlalchemy] Polymorphic Query All regardless of subclass

2019-02-28 Thread Andrew Martin
Hi All, Trying something out here for an analytics app here, and I'm not sure any of this is a good idea. I'm trying to create a data model that's flexible enough to handle a lot of different types of analysis. From plain CSVs to time series to survey questions with complex hierarchies. My

[sqlalchemy] Re: Best use of engine_from_config

2016-09-04 Thread Andrew Martin
Also, do be clear, what I have works. I'm passing the request object to the model and then creating the engine based on the request. It works, but I have a nagging feeling that this is not good and definitely not best. On Sunday, September 4, 2016 at 10:39:55 AM UTC-4, Andrew Martin wrote

Re: [sqlalchemy] Best use of engine_from_config

2016-09-04 Thread Andrew Martin
that dictionary instead of creating it with each > request. > > On Sun, Sep 4, 2016 at 4:39 PM, Andrew Martin <agmar...@gmail.com > <mailto:agmar...@gmail.com>> wrote: > I have a question about using creating engines along with pretty much any > python we

[sqlalchemy] Best use of engine_from_config

2016-09-04 Thread Andrew Martin
I have a question about using creating engines along with pretty much any python web framework, but I'm specifically working with Pyramid. For obvious reasons. :) The sqlalchemy docs state this: "The typical usage of create_engine()

[sqlalchemy] bulk_update_mapping stale data error

2016-05-03 Thread Andrew Martin
This is an admittedly wonky situation. And I don't have much code to offer because I think the problem is conceptual on my part, rather than code-related. We're basically using google spreadsheets as a quick and dirty interface for certain types of data entry. I know how terrible this is.