A Relational Spreadsheet
kevinlynagh.com
kevinlynagh.com
But the theory is, I love the relational database, they are a sort of rigorous superset of the spreadsheet, and I have replaced all my spreadsheets with database tables, however while it is very hard to beat sql for rich comprehensive data transforms and analysis, ad-hoc data entry is very awkward. Most gui tools are focused on database administration and I want one for quick random edits. any hints?
It uses jdbc drivers for database support, so it can handle basically anything.
If one of the obstacles to data entry is normalization, perhaps an updatable view if your database supports it.
Not as common as you might think. It is a hard thing to search for, and the ones I have been able to find all suck.
I wrote a PHP application a long time that allowed you to create a GUI for an 'arbitrary' SQL database table, using an XML schema to configure the appearance, validation etc. of the fields. Life got in the way, and I stopped development before it was ready for prime time. Fifteen years later, I went looking for something with similar functionality and was surprised at how few options there still were.
I understand that a spreadsheet "row" often isn't going to be a normalized SQL table row and all that, but isn't mapping the spreadsheet cell ranges into such a schema technically the only problem here?
If you had a script that watches your spreadsheet for changes and can drop you into a SQL shell whenever you want, you'd have it both ways.
But the topic here is about GUIs which serve the middle-ground between the "scalable, real, full-blown database" applications and the lowly spreadsheet. The SQLite project offers nothing that is comparable to Access.
We can have our cake and eat it too.
The mistake with Access was that instead of keeping a deathgrip on its legacy file-based roots, it ought to have "grown up" and become a web-native HTML5 app that uses SQL Server back-ends as the only option.
I still think there's a huge market for something like this.
It is still available even in the 365 package but I can't remember when I used it last time. It was long time ago.
DBeaver fills that need for me.
Or, alternately, separate the config process from the install process. I'd be much more comfortable running config commands from a script inside the docker container, or as a first-run setup UI, or as a simple .yaml config.
It does look like something I'd like to try out later, though. Either after the install process is cleaned up a bit, or once I have time to read through the whole install.sh script.
Edit: In case it matters, my personal preference is to install things as linux packages instead of Docker, but I understand that this is a stretch for early-access software.
Our current installation process was spun out of our local development setup, which isn't ideal.
Cleaning up installation is one of the top things on our to do list. This also includes documentation for setting up Mathesar without Docker. We'd like to do Linux packages as soon as we can too.
The tool that was great for this is FoxPro.
Is like access, but the genius thing is that it include a super-charged "repl" aka: the command window.
It allow to combine GUI + Help + Terminal in one single tool, so you can do
use table
browse // show a data table
go first // you can navigate both by mouse/keyboard and by code!I don't want to be dismissive, this is nice work and it's clean and lightweight. But it might be good to look at existing solutions in this area - pandas was developed within the financial industry to solve exactly this sort of issue. If you need more topological flexibility there is xarray, and if you need spreadsheet type immediacy it's worth looking into Mito.
Rustaceans should look into pola.rs: https://github.com/pola-rs/polars
Or, just use a relational database.
Alternatively, airtable and similar are basically relational databases that have some really neat features that let you create relationships by just copying/pasting data, or importing CSVs. They're limited in a lot of ways, but it solves a certain set of problems that can't be solved with code or excel.
import pandas as pd
df = pd.whaaargarrrrbllllll[(['what']['the']['fuck'), is.this['shit'], I, mean, seriously]
(outputs)
df[.astype('int64').fillna('spork')
df.groupby[['uppers']['downers']['all arounders']].join(inner, child, trauma, (yes && no))
df['confused'].very(simple['example']) # the thing being explained
I'm exaggerating, but not by much. Most examples in documentation or McKinney's tutorial work is presented as a complete small program in a REPL, and while that does make it easy to follow along by imitation, learning pandas feels like a painfully fragmented process at first. Also, tehre's a widespread assumption among pandas experts that people coming to pandas are already familiar with SQL, even more than Python in fact. I'm sure this reflects the initial user base and to bfair it's probably a true assumption for a lot of folk. But if you came from a more CS or scientific context rather than a database one, it's anotehr avoidable layer of confusion.I can't recommend a book unfortunately - I just worked with McKinney's own materials and suffered for a while until things started to click. Once I realized what I found frustrating about the tutorial materials I began to realize that I could read it more selectively - and also that the code base is in constant flux. There are often 2 or 3 different ways to do the same thing, with different approaches being deprecated or promoted over time.
import pandas as pd
import geopandas as gpd
census_df = pd.read_excel('census_data_yuge.xlsx').fillna(0)
muni_df = pd.read_excel('muni_data_yuge.xlsx.').fillna(0)
# assumes same criteria & column names in both
census_df.drop(['address 1', 'address 2', 'zip'], inplace=True)
muni_df.drop(['address 1', 'address 2', 'zip'], inplace=True)
cities = gpd.DataFrame(muni_df.groupby(['city']).mean() - census_df.groupby(['city']).dropna().mean())
gpd.plot(column='num_residents', cmap='bwr')
A fun exercise. I stuck to the time but score it as a C- because I cheated with geopandas (which I've never used but seems to do a lot of this out of the box) and gave myself unrealistically clean imaginary data. I have parsed census data once and remember it being a lot of work to tidy up before I even tried to answer my question.> This leads to a lot of logical conditions, since to prevent double-counting each aggregate tuple’s conditions must assert both that the matching tuples matched and that the non-matching tuples didn’t.
I understand and know to handle edge cases with SQL, I'd have to learn that all over again with a custom language and its own unique quirks. If I was putting such an investment, I'd want it to be better established.
Unless of course it's to scratch an itch and this is a perfect way to start out and share. Nice work and good luck.
(
polars_df1
.join(polars_df2, on=['state', 'county', 'timestamp'], suffix='_r')
.with_column(
( pl.col('val') + pl.col('val_r')).alias('val')
)
.select(['state', 'county', 'timestamp', 'val'])
)
and raise you: pandas_df1 + pandas_df2Polars:
polars_df.with_column(
pl.when(pl.col('timestamp').is_between(
datetime('2023-03-01'),
datetime('2023-03-31'),
include_bounds=True
)).then(pl.col('val') * 1.1)
.otherwise(pl.col('val'))
.alias('val')
)
Pandas: pandas_df.loc['2023-03'] *= 1.1Tldr: Mito is a spreadsheet that you can use to edit pandas dataframes, from directly within a Jupyter notebook. For every edit you make, Mito generates the equivalent python code, allowing you to perform some tricky pandas operations with the ease of a spreadsheet.
In practice, most of our most active users _are_ in the financial industry. They turn to Mito because they’re transitioning from spreadsheets to a programming language (for one of many reasonsg, but doing so while not knowing how to program is challenging. For most people, the hard part of writing code is the actually process of writing code - so we give these folks a spreadsheet interface they already know.
Happy to answer any questions / hear any feedback!
P.S. We’re open core + source available. Check it out if that’s your thing [2]
[1] https://trymito.io [2] https://GitHub.com/mito-ds/monorepo
All of the data was from several flat files, it consisted of each employee's hours for the period, accrued sick time, vacation time, comp time, etc. She had to manually copy and paste this data into Excel, fix formatting issues, then use it to calculate several totals. It was then fed into another system (that would only accept Excel files for input), that would print the pay checks with all this data summarized.
This was clearly critical for the organization, and it was taking her a couple days to do manually. I begged her, and my supervisor, to let me do the whole thing in SQL Server or MySQL, but she wouldn't have it, because it HAD to be something she could adjust manually. I explained I could make it look and feel like Excel, but she wouldn't have it.
I realize to anyone in databases (including me), I should have fought harder to do it right. However, as a new employee it was more important to gain trust than show off new technologies. So I compromised.
I setup a system that imported all of the data into SQL Server, cleaned it up, then exported it to Excel. The tricky part was working with VBA, and creating recursive expressions in Excel during the export. It took me about a week of time, mostly because I hadn't used VBA in a decade. The end product, from her point of view, looked exactly like her original spreadsheet. She could then still manually fix any issues that came about before importing it into the paycheck printer.
In the end, it saved her 2 days a week, or 8 days a month or 96 days a year. I became her new best friend. I was always the first to get my paycheck, and never had any issues when I needed support from finance. Probably the smartest move I made early in that job. ;)
I personally usually only involve a database if there's some significant amount of data involved and/or if it's significantly more efficient than the above
I don't get the hate on excel in this thread compared to rdbms's; i.e., just use a few vlookups for some joins which are usually sufficiently performant especially if you don't have that much data in which case you shouldn't be using excel in the first place... (though, if you're "clever" and want higher performance vlookups, just use it's often maligned indexed lookup feature more carefully to allow for both exact and indexed lookups which can be like >100x faster...)
When I tried a direct export, the system would interpret the cell references as values instead of parts of a formula. I had to parse each formula using CHR(). It also got tricky when I wanted to format the cell, say for currency. The final VBA script was barely 100 lines...
I may have some of this wrong, as it's been almost 9 years now.
A reminder for everyone excel web is actually entirely free and you can create stuff with https://excel.new
We spent a lot of time making it faster and rewrote a bunch of it ^^
(I'm just an engineer, I don't speak for my corporate overlords)
What is wrong with excel.office.com with a version toggle?
The .new TLD is pretty nifty. sheets.new gets you the same thing as excel.new, but for Google.
Using X.new seems like a bad idea, there is no way for me to understand if it's actually a official project by the companies themselves or just a random developer who has set that up. Maybe one day it'll ask someone for auth, they don't notice it's at microsoftweb.com instead of microsoftonline.com and get phished.
Really hard to trust random domains when a simple excel.office.com/new would do just as fine.
I love Excel, BTW :) just wanted to let you know in case you want to make it even faster (and easier to onboard presumably based on the domain).
> Spreadsheets are one of the hardest things you can build — right up there with compilers.
I think I would like to see a "democratization" of the technology and find books, and lectures about it as popular as we find books and lectures about compilers.
As for the OP I find their take interesting, of course you can accomplish that with more established tools but it was a refreshing read and an interesting, if not inspiring, notation.
PS: Is it possible that there is a regression when computing sheets with lots of open ranges (like =SUM(D:D))
Is this not what a pivot table does?
const data = await driveDb('sheet-id'); console.log(data); // [{ name: 'John', age: 31 }, { name: 'Sarah', age: 27 }, ...]
https://github.com/franciscop/drive-db/
It was born very similarly to how the article describes it. For low-amount of data, a spreadsheet is IMHO a much better low-tech collaborative tool than a database.
I believe it also allows you to run python code for data processing and jobs