• Activity
  • Votes
  • Comments
  • New
  • All activity
  • Showing only topics with the tag "sql". Back to normal view
    1. AI adoption and IntelliSense

      Complete off the top of my head thing, no source/research, just anecdotes and pontificating. As i've been doing some heavy editing today of a 300+ line SQL query, one thing I'm wondering about...

      Complete off the top of my head thing, no source/research, just anecdotes and pontificating.

      As i've been doing some heavy editing today of a 300+ line SQL query, one thing I'm wondering about with these AI usage stats are how much of the "adoption" falls into things like intellisense suggestions.

      There's two parts to this, with the first being just bad suggestions.

      I've found them to be "okay" for something like F#, but for SQL, which has always required me to knife fight for an alias to begin with, they're just utter garbage.

      I normally don't blow through my free github copilot suggestions in my month (I'm not in the code mines as much anyways), but I blew through it in a day of shitty SQL suggestions (and then just turned it off). This was last month, so not even while dealing with the current monster, and I'm left wondering how many people just have it vomit out useless stuff they change anyways.

      The second part, is just the usual "you don't really know your tools".

      While doing this query I considered turning it back on or using it. I have several CTE's for readability as this is a prototype but it necessitates an annoying pattern of taking the names of your columns, uplifting them to the next query select, and then summing and renaming them AGAIN such as SUM(COALESCE(a.example,0)) AS [example]

      When you have 84 columns to do this with, it can be tempting to let AI notice the pattern and just do it. However it's not actually necessary, and now that they're clocking the tokens as we knew they would, I'm back to just using my multi line editor skills. Middle click select, some home/end to get a starting point, then ctrl+shift+arrows mixed with Alt+arrows and some copy paste and I'm mostly done. Few Ctrl + D's or straight up find and replaces and I'd edited 80 lines in maybe 30 seconds?

      AI would've been a bit easier, and from what i've seen of MANY coders, something I suspect they only think is doable through AI. However much like how AI is getting people to use features they never even knew existed in their business tools, I wonder how much adoption on the coder side is the same. All these text editor helper tools many coders don't use (please keep all VIM manifestos under 400 pages) suddenly being automated out by the VASTLY more expensive AI.

      And like some of the other AI solutions, as the money starts to hit the budgets, I think we'll see a lot more "Look you need to learn how to do this normally" (or "hey guess what we're removing from VS code!").

      Not sure I have an overall point to this, but I'd be curious to hear what other people are seeing in their environments.

      18 votes
    2. How do I convince my workplace we need SQL databases?

      I work for a GIS company and our tools have not grown with our projects and client base. We use ArcPro personal geo databases (GDBs) for ALL data. We recently had a project where shit really hit...

      I work for a GIS company and our tools have not grown with our projects and client base. We use ArcPro personal geo databases (GDBs) for ALL data. We recently had a project where shit really hit the fan, one major issue was related to invalid values from poor version control. Everything uses personal GDBs and is just "version controlled" by dating filenames in Explorer. It would have been trivial to fix in a proper database. We also have operational constraints, like we can only have one person doing X job at a time since all the data for X job is in a personal GDB.

      But I'm just an analyst. I've garnered some attention for my technical expertise beyond processing the data. PostGIS is a thing so it isn't as though we'd be recreating the wheel. How can I push for that sort of change? I'm thinking I can sell it using how much we lost on this project because of these avoidable failures. I'm also wondering if I can make this an opportunity to create a "database administrator" position for myself

      29 votes
    3. What are your favorite Postgres features?

      You could use any SQL database to create a few tables, insert some data, and do queries, while ignoring anything vendor-specific. But Postgres has a lot of other features and many extensions. What...

      You could use any SQL database to create a few tables, insert some data, and do queries, while ignoring anything vendor-specific. But Postgres has a lot of other features and many extensions. What do you recommend checking out beyond the basics?

      I've used a lot of databases, but it's been many years, so I assume things have changed quite a bit. I skimmed a few PostgreSQL release notes and learned that there's now a MERGE statement that looks pretty handy. (It's standard SQL.) And from Neon's list of supported extensions, the plv8 extension caught my eye. It would let me write stored procedures in JavaScript. Does anyone use that? Do you use stored procedures at all?

      I wonder what Tildes uses?

      (To keep discussion organized, please write about one feature per top-level comment.)

      17 votes
    4. Dealing with databases, inserts, updates, etc. in Python

      Current Library: built in sqlite Current db: sqlite (but will have access to Snowflake soon for option 1 below) Wondering if anyone here has some advise or a good place to learn about dealing with...

      Current Library: built in sqlite
      Current db: sqlite (but will have access to Snowflake soon for option 1 below)

      Wondering if anyone here has some advise or a good place to learn about dealing with databases with Python. I know SQL fairly well for pulling data and simple updates, but running into potential performance issues the way I've been doing it. Here are 2 examples.

      1. Dealing with Pandas dataframes. I'm doing some reconciliation between a couple of different datasources. I do not have a primary key to work with. I have some very specific matching criteria to determine a match (5 columns specifically - customer, date, contract, product, quantity). The matching process is all built within Python. Is there a good way to do the database commits with updates/inserts en masse vs. line by line? I've looked into upsert (or inserts with clause to update with existing data), but pretty much all examples I've seen rely on primary keys (which I don't have since the data has 5 columns I'm matching on).

      2. Dealing with JSON files which have multiple layers of related data. My database is built in such a way that I have a table for header information, line level detail, then third level with specific references assigned to the line level detail. As with a lot of transactional type databases there can be multiple references per line, multiple lines per header. I'm currently looping through the JSON file starting with the header information to create the primary key, then going to the line level detail to create a primary key for the line, but also include the foreign key for the header and also with the reference data. Before inserting I'm doing a lookup to see if the data already exists and then updating if it does or inserting a new record if it doesn't. This works fine, but is slow taking several seconds for maybe 100 inserts in total. While not a big deal since it's for a low volume of sales. I'd rather learn best practice and do this properly with commits/transactions vs inserting an updating each record individually within the ability to rollback should an error occur.

      11 votes
    5. Recommendations to learn SQL?

      I read the AskReddit thread on "What costs less than $100 that changed your life?" (link unavailable since I'm at work) but someone responded "SQL" - jobs just open up that make a ton of money. I...

      I read the AskReddit thread on "What costs less than $100 that changed your life?" (link unavailable since I'm at work) but someone responded "SQL" - jobs just open up that make a ton of money.

      I did a cursory search on Indeed and holy moly they were right -- SQL jobs get easily 2x what I make now. I'm pretty good at Excel and that sort of thinking, so I was thinking I'd try taking a class.

      Do yall have any recommendations as to a good course to take in SQL, preferably online, preferably free or cheap? I'm willing to pay a bit if it'll mean I can make a lot more, but I'm currently not making a ton, haha.

      Any responses welcome, including ideas as to how to break into like, tech-oriented fields as well.

      9 votes