Ask Documentation
WebsiteGitHubPyPI
  • Introduction
  • Getting Started
    • Install & Get Started
    • Hello, World!
  • Routes & Requests
    • Routes
    • Defining Routes
    • Request Data
    • HTTP Status Codes & Methods
    • CORS
  • Response
    • JSON Response
    • JSON Response With an HTTP Status Code
  • Classes
    • Class Instance Variable
    • Initialization/Constructor Method
  • Data Types
    • Dictionaries
  • Built-in Utilities
    • Quick_set()
    • Deep()
    • Serialize()
    • Require_keys()
    • Random Generators
    • Pattern Matching
    • Email
  • Database
    • Ask and Databases
    • Models/Classes
      • Columns
      • Initialization/Constructor
      • Serialization
      • The &basic decorator
    • CRUD
      • Add
      • Select
      • Update
      • Delete
    • Check if a Row Exists
    • Sorting
    • Database Lists
  • JWT Authentication
    • Introduction
    • Protecting Routes
    • How to Create a Basic Login System
    • Properties & Methods of _auth
    • Making Requests to Protected Routes
  • Decorators
    • What are Decorators?
    • Create and Use Custom Decorators
    • Built-in Decorators
  • Security
    • Hashing
    • Route Security
    • Environment Variables
  • Configuring the Transpiler
  • Askfile.toml
  • Modules & Libraries
    • Importing an Ask Module
    • Includes
    • Importing Python Modules
  • Development Tools
    • Editor Syntax Highlighting
    • Automatic API documentation
    • CLI Flags
    • Running in development mode
    • Versioning System
  • Contribute
    • Feature Requests
    • Bug Reports
    • Contribute Code
Powered by GitBook
On this page
  • Practical
  • Technical
Export as PDF
  1. Database

Ask and Databases

How Ask handles database work.

Databases are easy to set up and easy to work with. Ask's design really shines when it comes to databases. Everything should be as simple and straightforward as possible. Ask reduces the needed boilerplate to get started to basically 0 lines, when compared to Flask.

Practical

  • All functions, variables, etc. used when working with databases are called on the built-in global db variable.

Technical

  • Ask uses SQLAlchemy behind the scenes. This can be useful to know when e.g. looking up errors.

  • The default database for all Ask applications is SQLite, it is however possible to connect other databases, like e.g. MySQL.

  • The database is by default stored in a file called db.db in your project's source directory.

PreviousEmailNextModels/Classes

Last updated 4 years ago