[sqlalchemy] Relationship to child with 2 foreginKey from same Parent column

2018-08-22 Thread Alireza Ayin Mehr
Hello, everyone I have a User model and a Conversation model class Conversation(Base): __tablename__ = 'conversations' id = Column(Integer, primary_key=True) user1 = Column(Integer, Foreignusers.id'), unique=False, nullable=False) user2 = Column(Integer, ForeignKey('users.id'), unique=Fals

[sqlalchemy] Setting many to many collection with secondary relationship when having only pk to one of the models.

2018-08-22 Thread Alex Rothberg
I am using an association model / table to represent a many to many relationship: class Geography(db.Model): id = ... class Fund(db.Model): id = ... geography_associations = db.relationship( lambda: FundGeographyAssociation, back_populates="fund", c

Re: [sqlalchemy] Encoding troubles with pythong, mysql and utf8mb4

2018-08-22 Thread Mike Bayer
This user's question is also on bitbucket where I've summarized what is likely going on, so we can avoid doing the same work twice here: https://bitbucket.org/zzzeek/sqlalchemy/issues/4085/warning-1366-incorrect-string-value#comment-47394537 On Wed, Aug 22, 2018 at 6:20 AM, Simon King wrote: > A

Re: [sqlalchemy] Multiple join paths and relationships that span across multiple tables

2018-08-22 Thread Mike Bayer
On Wed, Aug 22, 2018 at 11:34 AM, Alexios Damigos wrote: > Thank you for the reply. > The lack of foreign keys must be some bug of pastecode.xyz, because if you > see it on the browser or on "raw", they are indeed set just like your > suggestion. > > The issue is that I cannot manage to add a seco

Re: [sqlalchemy] Question about ShardedQuery Gevent parallelization

2018-08-22 Thread Mike Bayer
On Wed, Aug 22, 2018 at 6:03 AM, Carson Ip wrote: > This is my first post here. > > Software / Library versions: (tho unrelated) > sqlalchemy version: 1.0.19 > db: MySQL 5.6 > db driver: mysqlclient 1.3.7 > > Background: > I have 6 databases with a total of hundreds of shards. I realize when I add

[sqlalchemy] Re: Warning: Got 'None' querying 'table_name' from all_cons_columns - does the user have proper rights to the table?

2018-08-22 Thread Miguel Branco
Thanks, found the problem! The one of foreign key was pointing to one table that I don't have permission. quarta-feira, 22 de Agosto de 2018 às 11:10:25 UTC+1, Miguel Branco escreveu: > > I'm running the code below against an oracle database: > > from sqlalchemy import * > from sqlalchemy.ext.d

Re: [sqlalchemy] Multiple join paths and relationships that span across multiple tables

2018-08-22 Thread Alexios Damigos
Thank you for the reply. The lack of foreign keys must be some bug of pastecode.xyz, because if you see it on the browser or on "raw", they are indeed set just like your suggestion. The issue is that I cannot manage to add a second ForeignKey('sensor.id') to the tables batmon/radmon/deported, o

Re: [sqlalchemy] Multiple join paths and relationships that span across multiple tables

2018-08-22 Thread Mike Bayer
On Wed, Aug 22, 2018 at 5:50 AM, Alexios Damigos wrote: > Hello everyone, > > I have been trying to create a model for my database, with no luck so far. > I am using SQLAlchemy 1.2.10 together with PyMySQL 0.9.2 to connect to a > MariaDB database. > > A description of the database model: > > Table

Re: [sqlalchemy] Encoding troubles with pythong, mysql and utf8mb4

2018-08-22 Thread Simon King
According to https://dev.mysql.com/doc/refman/5.7/en/variables-table.html, VARIABLE_VALUE is a column in the INFORMATION_SCHEMA GLOBAL_VARIABLES and SESSION_VARIABLES tables. You could use the python warnings filter to turn these warnings into exceptions: import warnings warnings.simplefilter("er

[sqlalchemy] Warning: Got 'None' querying 'table_name' from all_cons_columns - does the user have proper rights to the table?

2018-08-22 Thread Miguel Branco
I'm running the code below against an oracle database: from sqlalchemy import * from sqlalchemy.ext.declarative import declarative_base, DeferredReflection Base = declarative_base(cls=DeferredReflection) class User(Base): __tablename__ = 'user' __table_args__ = {'schema':'si'} #Create a

[sqlalchemy] Re: Question about ShardedQuery Gevent parallelization

2018-08-22 Thread Carson Ip
Sorry for the messed up word wrap. I find this Google Groups web editor hard to use. On Wednesday, August 22, 2018 at 6:03:07 PM UTC+8, Carson Ip wrote: > > This is my first post here. > > Software / Library versions: (tho unrelated) > sqlalchemy version: 1.0.19 > db: MySQL 5.6 > db driver: mysql

[sqlalchemy] Error: Got 'None' querying 'table_name' from all_cons_columns - does the user have proper rights to the table?

2018-08-22 Thread Miguel Branco
I'm running the code below against an oracle database: from sqlalchemy import * from sqlalchemy.ext.declarative import declarative_base, DeferredReflection #Create and engine and get the metadata Base = declarative_base(cls=DeferredReflection) #Definição de dados ''' class Utilizador(Base):

[sqlalchemy] Question about ShardedQuery Gevent parallelization

2018-08-22 Thread Carson Ip
This is my first post here. Software / Library versions: (tho unrelated) sqlalchemy version: 1.0.19 db: MySQL 5.6 db driver: mysqlclient 1.3.7 Background: I have 6 databases with a total of hundreds of shards. I realize when I add more database hosts (and shards), my ShardedSession which queries

[sqlalchemy] Multiple join paths and relationships that span across multiple tables

2018-08-22 Thread Alexios Damigos
Hello everyone, I have been trying to create a model for my database, with no luck so far. I am using SQLAlchemy 1.2.10 together with PyMySQL 0.9.2 to connect to a MariaDB database. A description of the database model: Table A (components) *id brand status* N1 br3 free N2 br2 used N3 br2

Re: [sqlalchemy] Encoding troubles with pythong, mysql and utf8mb4

2018-08-22 Thread imad . youbi . idrissi
Sorry for my last messy message, here's a better version. That's a good question actually. If you follow my Stackoverflow Post you'll see I've updated it with the following information : The dataframe that is persisted in the database (See attached image): [image: DataFrame.JPG] So I actual

Re: [sqlalchemy] Encoding troubles with pythong, mysql and utf8mb4

2018-08-22 Thread imad . youbi . idrissi
Hello, That's a good question actually. If you follow my Stackoverflow Post you'll see I've updated it with the following information : The dataframe that is persisted in the database is : index 0 1 2 3 4 5 6 7 8 90 0 11 57 75 45 81 70 91 66 93 961 1

Re: [sqlalchemy] Encoding troubles with pythong, mysql and utf8mb4

2018-08-22 Thread Simon King
I've never used Pandas, so this may not make any sense, but where does the column "VARIABLE_VALUE" come from? Is it a column in your dataframe? Simon On Wed, Aug 22, 2018 at 8:52 AM wrote: > > I get the following warnings, when trying to save a simple dataframe to > mysql.: > > > C:\...\anacond

[sqlalchemy] Encoding troubles with pythong, mysql and utf8mb4

2018-08-22 Thread imad . youbi . idrissi
I get the following warnings, when trying to save a simple dataframe to mysql.: > C:\...\anaconda3\lib\site-packages\pymysql\cursors.py:170: Warning: (1366, "Incorrect string value: '\\x92\\xE9t\\xE9)' for column 'VARIABLE_VALUE' at row 518") result = self._query(query) And > C:\...anaconda