I hope the word "Types" is used correctly here. Perhaps I mean "Arguments". Feel free to edit.
I am creating a database using Models with Flask with SQLAlchemy, where can I find a list of all the different possible Column arguments such as:
account_id = db.Column(db.Integer, nullable=False)
I know some of the obvious types such as db.Integer
or db.String
. However I can't seem to find in the SQL Alchemy documentation, or the Flask documentation, a list of all possible arguments for creating a db.Column
instance. Am I looking wrong?
Is there a way of differentiating things like db.Integer
into tinyint, bigint, etc.?
As for options, such as the nullable=False
, I have had trouble finding a good list of all the possible options when creating a db.Column
instance.
function sqlalchemy.orm. column_property(*columns, **kwargs) Provide a column-level property for use with a mapping. Column-based properties can normally be applied to the mapper's properties dictionary using the Column element directly.
Querying Records For this purpose Flask-SQLAlchemy provides a query attribute on your Model class. When you access it you will get back a new query object over all records. You can then use methods like filter() to filter the records before you fire the select with all() or first() .
In Flask-SQLAlchemy, the backref parameter in relationship method allows you to declare a new property under a specified class as seen in the example in their docs: class Person(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(50)) addresses = db.relationship('Address', backref='person ...
PickleType. Holds Python objects, which are serialized using pickle. SchemaType. Mark a type as possibly requiring schema-level DDL for usage.
I think you're looking for the Column and Data Types page in the documentation. A little HTML parsing gives:
Documentation is directly perceived through the senses, but if you still wanna see it in commandline, try some IDE, or just type this:
(normally our db
is just SQLALCHEMY()
)
>>> print dir(sqlalchemy.types)
["ARRAY","BIGINT","BINARY","BLOB","BOOLEAN","BigInteger","Binary","Boolean","CHAR","CLOB","Concatenable","DATE","DATETIME","DECIMAL","Date","DateTime","Enum","FLOAT","Float","INT","INTEGER","Indexable","Integer","Interval","JSON","LargeBinary","MatchType","NCHAR","NULLTYPE","NUMERIC","NVARCHAR","NullType","Numeric","PickleType","REAL","SMALLINT","STRINGTYPE","SchemaType","SmallInteger","String","TEXT","TIME","TIMESTAMP","Text","Time","TypeDecorator","TypeEngine","Unicode","UnicodeText","UserDefinedType","VARBINARY","VARCHAR","Variant"]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With