|
POST
|
Yeah. Perhaps. Emphasis on HACK in my earlier post. There comes a point where a guy says, "yep, good enough"....
... View more
10-21-2021
03:28 PM
|
0
|
1
|
9593
|
|
POST
|
Among other things.... Soon I won't be able to say:
... View more
10-21-2021
03:03 PM
|
0
|
0
|
9596
|
|
POST
|
finally got this hack to give me what I want: import mysql.connector as mysql
cn = mysql.connect(user = 'user', password = 'pwd', host = 'host', database = 'master_db')
cursor = cn.cursor()
cursor.execute("Show tables")
tables = cursor.fetchall()
for table in tables:
cursor.execute(f"select * from master_db.{table[0]}")
rows = cursor.fetchall()
print(f'{table[0]}, {len(rows)}')
... View more
10-21-2021
02:43 PM
|
0
|
4
|
9598
|
|
POST
|
Happens to the best of us: you get to a point of diminishing returns despite your best efforts!
... View more
10-21-2021
01:28 PM
|
1
|
0
|
2217
|
|
POST
|
mySql Took care of the double From and get a different error... File "C:\Clones\Pro282\lib\site-packages\mysql\connector\connection.py", line 1169, in handle_unread_result raise errors.InternalError("Unread result found") InternalError: Unread result found
... View more
10-21-2021
01:07 PM
|
0
|
0
|
9633
|
|
POST
|
Take a look at the parcel with the global id mentioned above: my guess is it has a null value or something else goofy in one of the attributes you are trying to concatenate.
... View more
10-21-2021
01:07 PM
|
1
|
1
|
2227
|
|
POST
|
Back in 2020 I was messing around with python and mySql. (see this post) and today I'm back to it. I can get a list of tables in my database like this: import mysql.connector as mysql
cn = mysql.connect(user = 'myUserName', password = 'myPassword', host = 'myHost', database = 'master_db')
cursor = cn.cursor()
cursor.execute("Show tables;")
myresult = cursor.fetchall() myresult is a list of tuples that looks a little like this: [('accessmoderules',),
('accessmodes',),
('activitylogs',),
...
] What I want to do is loop through myresult and return the table name and the number of records right next to it, but can't quite seem to get it right. If I try this: for table in myresult:
query = f""" SELECT * FROM from master_db.{table[0]};"""
number_of_rows = cursor.execute(query) I get this error: ProgrammingError: You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server
version for the right syntax to use near 'from master_db.accessmoderules'
at line 1 I can run that very query in a MySql Workbench window and get what I want: What am I missing on the python side of things? @RandyBurton
... View more
10-21-2021
12:44 PM
|
0
|
10
|
10720
|
|
POST
|
Check out the answer provided here by @XanderBakker Does it help?
... View more
10-21-2021
09:01 AM
|
1
|
0
|
1750
|
|
POST
|
Sorry, I'm at a loss here. May be time to contact ESRI tech support.
... View more
10-21-2021
08:40 AM
|
0
|
0
|
1426
|
|
POST
|
Hard saying if it's a bug or not since it worked and now does not. What version are you editing? I understand that it's "versioned" but do you have additional versions besides default?
... View more
10-19-2021
08:56 AM
|
0
|
1
|
1456
|
|
POST
|
@JoshuaBixby has hundreds if not thousands of posts; it may have been a older discussion we had before this forum was in place...
... View more
10-19-2021
08:24 AM
|
0
|
0
|
2547
|
|
POST
|
Kind of tough to comment without a better, more detailed description of your workflow. I take it this is a versioned GDB; traditional or branch? Are you running the script as a stand alone or within a Pro session?
... View more
10-19-2021
08:09 AM
|
0
|
0
|
1468
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-11-2018 07:12 AM | |
| 1 | 05-17-2021 11:18 AM | |
| 1 | 06-29-2021 11:42 AM | |
| 1 | 07-05-2012 07:49 AM | |
| 1 | 09-03-2016 06:16 AM |
| Online Status |
Offline
|
| Date Last Visited |
2 weeks ago
|