SQL data sources

If your sales live in a database, StockAI can query it directly from Data sources and save the result as a sales file.

On this page
  1. Supported databases
  2. Creating the connection
  3. Writing and testing the query
  4. Training on the result
  5. What it does not do: sync on its own

Besides uploading a CSV or an Excel file, you can connect StockAI to your system's database, write the query that brings your sales, and train on the result. You do it under Data sources (/archivos), the second tab of My sales.

Supported databases

EngineDefault port
PostgreSQL5432
MySQL3306
SQL Server1433
Oracle1521

Creating the connection

  1. In Data sources, press "New Data Source" and choose "SQL Database".
  2. Type a name, pick the "Engine" and fill in host, port, database, username and password.
  3. Press "Create Connection" and then "Test Connection": it should say "Connection successful". Until you test it, the source cannot be queried.

Writing and testing the query

On the "Query Editor" tab you write the SELECT that brings your sales. The columns it returns are the columns the source will have: at least a date, a product and the quantity sold, just like a file. "Run" shows a preview of up to 500 rows; "Save Query" keeps it on the source. Each query has 30 seconds to answer.

"Download Excel" downloads the full result as .xlsx, in case you want to check it before using it.

Training on the result

"Use as dataset" runs the full query and saves the result as a new file, which appears under My sales ready to train, just like one you uploaded. From there you follow the same path as uploading your sales: confirm the columns and let the system learn.

  • The result can have up to 500,000 rows. If the query returns more, StockAI does not cut it: it refuses with "The query returned more than 500000 rows, the save limit. Narrow it with WHERE or LIMIT."
  • If the query returns nothing: "The query returned no rows — there is nothing to save."
  • If the database rejects the query, the message starts with "The query failed:" followed by the error exactly as your database gave it.

What it does not do: sync on its own

Saving the result is a snapshot, not a live connection. That is deliberate: a forecast has to be reproducible against the data it trained on.