[sqlalchemy] Re: custom encryption for db columns/fields

2020-05-20 Thread Justvuur
Thanks! This is great! Regarding the extension of PostgreSQL, do you have an example for that? On Tuesday, 19 May 2020 22:13:28 UTC+2, Jonathan Vanasco wrote: > > > On Tuesday, 19 May 2020 19:24:48 UTC+2, Justvuur wrote: >>> >>> Is it possible to create a c

[sqlalchemy] custom encryption for db columns/fields

2020-05-19 Thread Justvuur
Is it possible to create a custom encryption/decryption algorithm that can be used with sqlalchemy querying/filtering? When querying and filtering, I would like the field to automatically decrypt using the custom algorithm. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper

[sqlalchemy] Re: custom encryption for db columns/fields

2020-05-19 Thread Justvuur
Versions: SQLAlchemy = 1.2 PostgreSQL = 11.2 On Tuesday, 19 May 2020 19:24:48 UTC+2, Justvuur wrote: > > Is it possible to create a custom encryption/decryption algorithm that can > be used with sqlalchemy querying/filtering? > When querying and filtering, I would li

[sqlalchemy] Re: custom encryption for db columns/fields

2020-05-22 Thread Justvuur
Regarding the extension of PostgreSQL, do you have an example for that? On Tuesday, 19 May 2020 22:13:28 UTC+2, Jonathan Vanasco wrote: > > > On Tuesday, 19 May 2020 19:24:48 UTC+2, Justvuur wrote: >>> >>> Is it possible to create a custom encryption/decryption algo

[sqlalchemy] Union query between multiple tables

2020-06-02 Thread Justvuur
Hi All, I would like to do a union between 3 or 4 tables using the all powerful sqlalchemy. The tables have about 3 columns that are the same but each table has 2 different columns. Is it possible to do a query as below in sqlalchemy? Select Col1, Col2, Col3, Col4, Col5 from Table1 Union

[sqlalchemy] convert subset to dictionary

2020-07-02 Thread Justvuur
Hi there, I'm struggling to find an efficient way to get a two columned subset into dictionary form. I have an entity that has a subset of data. The subset is linked to the entity via Id. The order of the subset of data is defined in another table. Example: Student - Id, firstname, lastname

Re: [sqlalchemy] convert subset to dictionary

2020-07-08 Thread Justvuur
I'd like to redesign the DB but that's not on the cards at the moment (or ever hehe). Thanks for the feedback, I appreciate all the help, I really do. What puzzles me now is, why would the looping through each student (using with_entities) and getting the subjects (using with_entities) for each

[sqlalchemy] Encrypt/Decrypt specific column(s)

2020-07-08 Thread Justvuur
Hi All, In one or two database tables I need to encrypt/decrypt a couple of columns. These tables/columns already exist in the DB and they already have data in them. What is the best way using SQL Alchemy to add encryption to these tables/columns? It needs to be efficient and the columns need

Re: [sqlalchemy] convert subset to dictionary

2020-07-08 Thread Justvuur
XPLAIN ANALYZE) to understand why. > > Simon > > On Wed, Jul 8, 2020 at 8:22 AM Justvuur wrote: > > > > I'd like to redesign the DB but that's not on the cards at the moment > (or ever hehe). > > > > Thanks for the feedback, I appreciate all the help, I really d

Re: [sqlalchemy] Encrypt/Decrypt specific column(s)

2020-07-09 Thread Justvuur
s None even though I have an encrypted value of "secrets" in that column. Any idea what I could be doing wrong? On Thursday, 9 July 2020 16:37:17 UTC+2, Mike Bayer wrote: > > > > On Thu, Jul 9, 2020, at 4:53 AM, Justvuur wrote: > > Hi Mike, > > This is awesome! Yes

Re: [sqlalchemy] Encrypt/Decrypt specific column(s)

2020-07-09 Thread Justvuur
2020 at 2:12:36 PM UTC-4, Justvuur wrote: >> >> I've done some more digging... It seems when I did the search for >> "secrets", the text is encrypted and compared to the value in the columns, >> > > That is how client-side encryption works. If you want to

Re: [sqlalchemy] Encrypt/Decrypt specific column(s)

2020-07-09 Thread Justvuur
ot;? On Thursday, 9 July 2020 19:15:32 UTC+2, Justvuur wrote: > > So there is good news and bad news hehe. > Good news is if I query all the other columns (no encrypted) columns it > works. All results are returned correctly and decrypted. > Bad news, if I query the encrypted column,

Re: [sqlalchemy] convert subset to dictionary

2020-07-07 Thread Justvuur
that to take longer > than a couple of seconds though. > > Simon > > On Mon, Jul 6, 2020 at 7:34 PM Justvuur wrote: > > > > I added the eager-loading but it seems to slow down the SQL query quite > a lot. > > It's as if now, the SQL query is taking longer but t

Re: [sqlalchemy] convert subset to dictionary

2020-07-07 Thread Justvuur
its memory and cause it to start swapping, > which would hurt performance, in which case querying for smaller > amounts of data might be better. > > Simon > > On Tue, Jul 7, 2020 at 12:53 PM Justvuur > > wrote: > > > > I'm currently testing with 7000 stud

Re: [sqlalchemy] convert subset to dictionary

2020-07-06 Thread Justvuur
the students, to load > that student's subjects. Eager-loading allows you to preload the > subjects for every student in a single query: > > > https://docs.sqlalchemy.org/en/13/orm/loading_relationships.html#joined-eager-loading > > > Simon > > On Fri, Jul 3, 2020 at 1:3

Re: [sqlalchemy] convert subset to dictionary

2020-07-03 Thread Justvuur
s in the SQLAlchemy docs that > provide a dictionary-style API: > > > https://docs.sqlalchemy.org/en/13/orm/examples.html#module-examples.dynamic_dict > > > > https://docs.sqlalchemy.org/en/13/orm/examples.html#module-examples.vertical > > Hope that helps,

Re: [sqlalchemy] Union query between multiple tables

2020-06-04 Thread Justvuur
gt; > > I'd recommend using union() and select() to create these queries. the ORM > Query.union() method is not as easy to use and long term the above > technique with union() and select() will be how it's done. > > > > > On Tue, Jun 2, 2020, at 2:09 PM, Justvuur wrote: >

[sqlalchemy] SQL Alchemy TypeDecorator

2022-08-09 Thread Justvuur
Hi there, Is there a way to pass/access model data for a row within the " process_result_value" method of a TypeDecorator? For example, I want to decrypt the value but only if another value in the same model row is true/false. Regards, Justin -- SQLAlchemy - The Python SQL Toolkit and

[sqlalchemy] SQLAlchemy exists() used with first() ?

2022-08-09 Thread Justvuur
Hi there, When creating another column property in a model that makes use of the exists(), I noticed that the exists does a "select *". *For example, the form exists below:* class Contact(ResourceMixin, db.Model): __tablename__ = 'contacts' form_contacts = db.relationship(FormContact,