« first day (4301 days earlier)      last day (640 days later) » 

8:15 AM
@PM2Ring Thanks, that made me finally get it. So relative_brightness = 1/(100**(1/5))**(apparant_magnitude). That seems not very clear in the wiki article. Now back to looking at the original data with this new understanding :)
 
 
1 hour later…
9:37 AM
TIL that if you accidentally write .. foo: instead of .. foo::, sphinx will just silently ignore that line. Wonder how many people learned that the hard way like me
 
10:02 AM
Is that an ReST comment or just garbage then?
I never remember how comments work in Sphinx, I just randomly try things until code highlighting switches to gray.
 
I have no idea
 
10:16 AM
actually, .. foo: is directive syntax, which is what you usually want, right?
wouldn't .. foo:: give you a literal colon with text before it?
 
I've got things like .. code-block:: python3, so it means something at least.
 
I've got .. versionadded:: 1.5
 
sqlfiddle.com/#!4/028a51/1 Taking another shot at a sane problem description: every employer has a unique employer_id. Each employer assigns employee ids to its employees, ensuring that the id is unique within their own business. They refuse to coordinate with other businesses, so lots of employee ids overlap globally. As a result, I am forced to use (employer_id, employee_id) as a composite primary key.
My goal is to choose one row from each distinct position. The code I have works, but it uses rowid, which is scary and brittle. What are my alternatives?
I recall that Aran-Fey suggested partition yesterday, I must take a second look at that
 
Ah, I forgot that syntax I guess
@Hakaishin you're linking to the main page
 
yeah, todays comic is funny and it mentions python :P
I think it's fine for it to be ephemeral
 
I think I experimented with partition while sleep-deprived last night, and I couldn't get it to work. So it's not 100% trivial
 
I wrote it yesterday and today I remember exactly nothing about how it worked :|
 
10:59 AM
with temp as (
  select employees.*,
    ROW_NUMBER() OVER (PARTITION BY position ORDER BY employee_id) row_nr
  from employees
)
select * from temp
where row_nr = 1
 
11:09 AM
Would love to know why that with temp as is required btw
select employees.*,
  ROW_NUMBER() OVER (PARTITION BY position ORDER BY employee_id) row_nr
from employees
where row_nr = 1
-- "ROW_NR": invalid identifier
 
Based on my experience, Oracle name resolution is wonky
Consider a simpler example: sqlfiddle.com/#!4/028a51/29. Still can't find the identifier.
 
Ok, you know what, that's enough SQL for the rest of the year
 
I reckon it's because it evaluates the query in a nonlinear order. Like the evil twin of a list comprehension. Something like:
for row in employees:
    if len(loudname) > 3:
        loudname = row["name"].upper()
        output.append({"loudname": loudname})
The with temp clause is effectively like having two consecutive loops, where the first creates the loudname values, and the second may look at loudname in its if clause
I know! Oracle should introduce the walrus operator! This is an excellent plan.
Today will likely be the apex of my SQL frenzy, so you can look forward to returning to a peaceful Python-based existence at quitting time (EST)
 
11:37 AM
Possibly useful: assigning a unique number to each row. Took me a while to figure out that row_number() has to have an over clause, but it doesn't have to have a partition by clause.
 
12:01 PM
You can do some weird yam with CTE... even in sqlite: sqlite.org/lang_with.html - the sudoku solver example is one of my favourites
 
sqlfiddle.com/#!4/028a51/36 Pros: result has exactly the same columns as employees without having to specify each name individually. Cons: probably O(N^2). Still uses rowid.
I could eliminate the rowid reference and write proper comparison logic based on composite primary key, but it pains me
 
I don't think that would work? With > rowid, you're checking whether that's the last employee with a given role. You can't do that with the primary key
 
12:16 PM
I think I can do it if I use case, i.e. Oracle's ternary operator. Also, since I'm happy to take any representative row that's easy to take, I don't mind changing my logic to get the first employee in the group rather than the last one.
... Or possibly vice versa? I'm very turned around
 
Ok, I've got no clue about case
 
Apparently, me neither, because Oracle doesn't like me using it in a where clause
 
12:32 PM
Probably it has different expectations for "expressions that return a boolean" vs "expressions that might return a non-boolean". In the query select a from b where c < d, the expression c < d is guaranteed to have a boolean result. But if I tried select a from b where case c < d then e < f else g < h end, The parser doesn't know for sure that the case ternary will always return a bool.
We humans can easily see that it does, simply by observing that it can only evaluate to one of e<f and g<h. But presumably the parser wasn't designed to go crawling all through the AST to prove type consistency.
 
Umm... wouldn't your example just be better as a self-join?
 
I am receptive to this proposal
 
the query planner might then have a slight chance at working it out
thinking out loud... something like: select t1.* from employees as t1 cross join employees as t2 where...
 
While we ponder self joins, here is my case-based proposal, except I replaced case when X then Y else Z end with (X and Y) or (not X and Z), plus some simplification
 
1:19 PM
Pros: O(n log n) run time; no usage of `rowid`
Cons: result has one more column than the input; uses arcane aggregate function that none of your coworkers will be familiar with
 
hello - is it bad form to mix classes and functions in the same module?
 
In my opinion, it's fine
 
ok thanks
 
2:12 PM
<hauls carcass over the threshold> c... bg.
 
Cbg. Who did you kill today?
 
If anyone says to me "It's ready to go, you just need to hit the deploy button" to me again, I will not be responsible for my actions. All of the fires
 
whoever says that: let them hit the button :P
 
He's off for a week. The customer started ringing him anyway so I feel a little better about that :P It was a completely irreversible detonation so I had no choice but to go forwards and just... hope :/
 
Add a "don't press this button" above the button and wait?
 
2:16 PM
No more buttons! Buttons are bad!
 
Might be able to clog it up with cabbage.
Anyways... someone already pressed the button? How was the fireworks?
 
I pressed the button. On good authority that it did a good. It did not do a good
 
hang a sign that says "days since someone pressed the button:"
 
That reminds me of when I first got to the Tesco offices. They had a sign for "days since last unicycle accident". Turns out, it wasn't joke. They used to take one out in the car park at lunch
@Kevin For these situations you would generally have an "association table" where you would have a many-to-many join between employer and employee ids
Though that might be overkill for your setup and probably not worth going back and implementing for something rather small. It depends on how extensible it needs to be going into the future
 
2:44 PM
I don't mind making an association table. Who knows what the DB administrator's opinion is, though.
I'm not sure if a many-to-many relationship makes sense on a conceptual level. An employer has many employees, but an employee has only one employer. (yes, having two jobs is a thing that happens in real life, but it doesn't happen in my hypothetical world)
I think the most practical approach would be to create a blind primary key for the employees table. Guaranteed globally unique, regardless of what the employers assign to the employees.
 
Oracle is making me grumpy. I haven't used it before. Stop telling me I'm doing it wrong :'(
I have found my people
Pernicious doesn't even begin to describe the level of frustration Oracle causes with these nonstandard practices. — Don Scott Mar 18, 2014 at 23:32
 
3:06 PM
If you just want to convey the usefulness of some general SQL design principle, feel free to use any SQL dialect you like. Don't contort yourself into valid Oracle for my sake :-)
 
I actually wanted to play a little bit before passing anything back to you so I shall battle through :) I'm not convinced my thought process will buy you anything. Also, thinking about it more, you might be just fine with the rowid because I'm not sure any concurrent write is going to get in your way - that should go into the write-ahead log. But I don't know for Oracle
Also, I feel I should know what it's complaining about anyway but even from that answer I don't know what it's flapping about. And it won't let me start my CTEs with an underscore, which is just a red card
 
3:20 PM
The majority of my "invalid identifier" errors are because my where or group by logic contains a name that I defined inside my select. Earlier in the transcript, you can see how this very problem made Aran-Fey swear off databases until 2023.
"I feel I should know what it's complaining about" -- only the most powerful oracles of Oracle can divine the true meaning of their cryptic syntax errors
If I had a nickel for every time I got "missing right parenthesis" in an expression that had N left parens and N right parens... I'd have like, a dollar this month.
 
In postgres I actually go out of my way to follow my own mental style guide, despite the fact that the engine itself doesn't enforce it, because I know it will help future roganjosh. This one is just complaining at me for what would be perfectly valid in other dialects
 
Yep, I had that yesterday when select a, b from T group by a worked in sqlite but not Oracle.
It took me a very long time, but I'm beginning to understand the shape of their madness. The reason why select a, b from can be valid syntax in some contexts but not others. I think lizard people and the hollow earth are involved at one point.
 
3:39 PM
Honestly, I'm on oracle's side there. select a, b from T group by a conceptually makes no sense, so it's weird that it works in SQLite
Although there should be a(n easier) way to say "give me an arbitrary b"
 
Yeah.
 
3:57 PM
I'm trying to run a script that was written in 3.5 and I'm using 3.8.
import subprocess
import sys
from numba import jit, autojit
on this part
ImportError: cannot import name 'autojit' from 'numba' (C:\Anaconda3\lib\site-packages\numba_init_.py)
the only thing I can find is this: github.com/brohrer/lodgepole/issues/1
 
so in there script they put this
@jit(nopython=True)
mine has this
@autojit
is it as easy as putting (nopython=True)
lol
 
That's just @njit I think...
You probably want @jit() unless the other one works too. You'll know after the first function call.
 
4:15 PM
yup that's what worked! Thank you!
@jit(nopython=True)
 
>put `nopython = True` in a Python script
>it vanishes in a puff of logic
 
@kevin I have concluded that Aran's method with the partition is probably the best you'll get on this. I was trying some fancy join but it just doesn't make sense
 
"After two days of discussion, we've decided the best approach is the one that was proposed in the first twenty seconds of discussion"
3
 
Lizard people are hard negotiators
 
4:23 PM
Yes, don't you listen to David Icke? (Please say no)
 
No
Should I?
 
best outcome of my day so far. Thank you for that
 
haha
@roganjosh So there is a reptilian in this chat?
 
No, in Oracle. And just saying that, it really does start to sound conspiratorial
 
Oh
This is very serious :P
Wouldn't you be being controversial? If you don't believe in the reptilian conspiracy theory, how can you say that there are reptilians in Oracle?
:P
 
4:30 PM
Lizard people don't exist. Except in Oracle where they do. And probably nasal demons too
I will happily throw more unsubstantiated claims at a proprietary product when a vastly superior free and open-source alternative exists. I wonder what I'll "catch" Oracle at next!
 
That exception ("Except in Oracle where they do") make the "Lizard people don't exist" assumption false.
@roganjosh So do you think that the Oracle is the best proprietary RDBMS?
 
Does the exception "except when it rains" make the assumption "the sun shines in the daytime" false?
 
This case is very different
If Lizard people don't exist, don't exist anywhere
 
@Kevin Yessssss.
 
But I got it
So Lizard people exist only in Oracle (according to Roganjosh). Ok.
I just don't understand why Roganjosh doesn't want me to believe in the reptilian conspiracy theory if he does (well, "there are reptilians at Oracle").
 
4:46 PM
I mean, I could find a multitude of different words that try to explain the humour but "I was just being an idiot and going along with it for attempted humour" probably suffices
For the record, I don't believe in lizard people. I would have hoped that was self-evident based on my other discussions that have at least some grounding in sanity. If not, I will try work on it
 
Haha
Ok :P
 
Acting like you believe something that you don't believe in has many practical applications in game-theoretical scenarios. May as well get some practice in, when the stakes are low
 
Maybe the lizard people at Oracle were doing that with me when they threw my syntax out. It's all just a big game for them
 
@roganjosh For the record, so you think that even in Oracle there are no reptilians. Ok. :P
@Kevin For sure.
@roganjosh Who knows.
 
Marco will be richly rewarded by his reptilian master for convincing roganjosh to publicly doubt their existence. Another piece in this 5D chess game has been taken off the board.
 
4:52 PM
Without a doubt, it could be that I am a reptilian and don't know it.
Even Roganjosh can be one.
 
You better hope not because otherwise I've just exposed a giant schism over SQL that could threaten humanity as you "know" it
 
¯_(ツ)_/¯
(I don't know why the left arm is not showing, but ok).
 
It escaped
 
The lizard people ate it!
 
Yeah :(
All makes sense now
Side note: Python (the snake genus) is a reptile.
Maybe it makes some sense.
 
 
3 hours later…
user16858520
8:12 PM
hola legends
 
I wonder if a development tool like this exists: I have a database with a large number of tables. Suppose each table has a primary key, and may have any number of foreign keys. I would like to enter the names of two tables, A and Z, and see which tables I need to traverse to get from one to another.
For example, it might say grommet.pallet_id = pallet.pallet_id; pallet.current_location_id = warehouse.location_id; warehouse.foreman_id = employee.employee_id; employee.preferred_safety_hat = sale_catalog.product_id. Now I can implement a feature where, if a customer is particularly pleased with the quality of their grommet, they can buy the responsible foreman a new hat which he will surely like.
 
breadth first search has entered the chat
 
8:27 PM
Yeah. I could certainly write one myself. But if there's one I can download and run in five minutes, and it already knows how to avoid Oracle's 1000 corner cases, then I would prefer that.
I think the free market of ideas isn't meeting my needs, because I'm halfway between the two biggest demographics. First, the people who are happy to just do whatever and keep trying random things until something works. They don't need diagrams, they just need grit and overtime hours.
Second, the people who want dazzlingly clear indicators of relationships between tables. They don't need diagrams, because they already got their boss to buy the whizbang 300-in-1 ORM / query planner / static code linter / teeth whitener. It projects the UML directly into their subconscious while they dream at night.
And of course, it costs $10,000 per person per year because they put "enterprise" in the title
 
sigh. FGITWs can be wrong in multiple ways and not help solve the problem (which is itself unclear), and still get upvoted before the question can be closed.
(thankfully, a downvote plus a comment with a detailed explanation of what is wrong with the answer, will often get the answerer to delete)
 
8:45 PM
FGITWs have wasted much of my time this week. I would research a design problem I was having, and find a question that matched almost perfectly, and it would be full of brainless replies that only work if several unfounded assumptions about the data hold true. Things like "a person's first name can uniquely identify them"
Of course, I still had to read through all of them on the off chance that one of them would actually have the correct answer
 
 
2 hours later…
10:23 PM
@Kevin I could write it. Joking.... not joking... maybe joking?
On a serious note, you could write it easily. Blow their subscription out of the water
SQL wouldn't take you much time. 1 Month, tops
 
10:48 PM
I do know a little bit about fetching table metadata from Oracle's table table. I probably have 75% of the pieces I need already
 
By SQL I mean't "learning SQL" sorry. You're pretty much there. You have 90% of the pieces as far as I can see
The bits you don't - steal them. I needed the barcode scanner from the factory stores so I just went and wove a lovely story about how things will work in the future... after being explicitly denied from building the system. On second thought, it might not be the safest approach :P
Still, it goes beep beep in, and beep beep out. I probably got this
 

« first day (4301 days earlier)      last day (640 days later) »